Thread locals keep Rust shared library from unloading dlclose
.
#59629
Labels
A-thread-locals
Area: Thread local storage (TLS)
C-bug
Category: This is a bug.
O-linux
Operating system: Linux
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
OS: Ubuntu 18.04
Doesn't seem to happen on Windows, untested on MacOS.
I created
cr-sys
crate to wrap cr.h: A Simple C Hot Reload Header-only Library.It works, except that each version of the plugin isn't unloaded correctly, if the plugin uses TLS destructors registered with
__cxa_thread_atexit_impl
.C++ plugins can be compiled with
-fno-use-cxa-atexit
to disable the use of__cxa_thread_atexit
. But I can't find away to do this with Rust plugins.Right now the only work around is to not unload old plugin and make sure to use a different name for each plugin version.
Is there any way to run the TLS destructors registered by the plugin or to disable TLS destructors for a Rust shared library?
Related issue on
cr.h
:fungos/cr#35
The text was updated successfully, but these errors were encountered: