Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAvoid leaking outstanding Trusted values when tearing down a script task #5907
Labels
Comments
|
The alternative is that we could simply rely on the failure of sending messages to the script task to deal with this, under the assumption that we clear the TLS table immediately before destroying the runtime and guarantee that we will not process any further events in the script task after doing so. |
|
@jdm Don't we clear that TLS table now? |
|
No. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We have a table of explicit roots for trusted values in TLS. Besides storing the reference count there, we could also store a boolean value that indicates whether the root is still valid. All of the methods in Trusted could check that boolean value and panic if it's false - this would take down any non-script task that tried to clone one, or dropped the final reference to one, and would catch any invalid cases in the script task that tried to root Trusted values after they are no longer valid. By adding these checks, we could clear the TLS table before destroying the runtime, thereby invalidating outstanding long-term roots for JS values.