-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BigFloat stored in WeakKeyDicts cause segfaults when garbage collected #26939
Comments
Finalizers are currently being run in the order they were added, but should instead be run in reverse order to help guard against this. In versions <=0.3 we did that by keeping a linked list for each object with finalizers, which was slower but avoided this issue. For now reversing the |
Why the reopen? |
Answer: if the WeakKeyDict is locked, the finalizer re-schedules itself to try again later, but that will be too late since the other finalizers for the key will run during the current round of finalization. This is at least much less likely than the example in this issue though. Also, the problem should no longer exist for BigFloats since they no longer use finalizers. |
Note that in this example, its likely guaranteed not to occur. Since we only add precisely one value to the dictionary and then drop everything, for the test we will never be found holding the lock while there are potentially values in the dictionary. |
Delay cleanup of WeakKeyDict items until the next insertion. And fix `get!`, since previously usage of it would have added keys without finalizers to the dict. Fixes #26939
Delay cleanup of WeakKeyDict items until the next insertion. And fix `get!`, since previously usage of it would have added keys without finalizers to the dict. Fixes #26939
Delay cleanup of WeakKeyDict items until the next insertion. And fix `get!`, since previously usage of it would have added keys without finalizers to the dict. Fixes #26939
Delay cleanup of WeakKeyDict items until the next insertion. And fix `get!`, since previously usage of it would have added keys without finalizers to the dict. Fixes JuliaLang#26939
In v0.6.2
This error is similar to #18204 (comment)
MWE:
REPL:
The text was updated successfully, but these errors were encountered: