-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Crash in cleanup_task_local_map when the map contains a closure with a managed box whose destructor accesses the task local data #8693
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
Comments
I believe that this would be fixed by #8447, but there's still a question of whether accessing TLS from when TLS is getting destroyed is even a legal operation. If TLS destruction creates always creates more TLS, you never can actually destroy TLS... |
By fixed I mean it probably won't crash (haven't tested it) |
Thanks! I'm going to change the module to avoid using the TLS in during destruction, but am glad to hear that the fix should clean up this issue. |
@larsbergstrom, can you confirm whether this is fixed now or not? The problem of TLS attempting to access TLS during destruction I believe is a separate issue from this one. |
@alexcrichton Yes, we've worked around this specific case by changing glfw-rs to no longer use TLS and destructors in this fashion. If you've got the more general case logged elsewhere (what to do about TLS access during a destructor being run as a result of task shutdown), I'm fine with closing it. |
Cool, thanks! Closing in favor of #8302 |
When there is a closure that captures a managed box with a destructor, stores that closure in the task local data, and then the destructor for that managed box also tries to touch the task local data, there will be a crash (accessing freed memory) during shutdown in cleanup_task_local_map, and occasionally some warnings about leaked memory.
Below is a small example that uses glfw_rs. When callbacks are set in that module, they are registered in a HashMap in task local storage, and the destructor for the Window struct removes them from that HashMap.
The text was updated successfully, but these errors were encountered: