Skip to content
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

Thread locals keep Rust shared library from unloading dlclose. #59629

Open
Neopallium opened this issue Apr 2, 2019 · 0 comments
Open

Thread locals keep Rust shared library from unloading dlclose. #59629

Neopallium opened this issue Apr 2, 2019 · 0 comments
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.

Comments

@Neopallium
Copy link

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

@jonas-schievink jonas-schievink added A-thread-locals Area: Thread local storage (TLS) C-bug Category: This is a bug. labels Apr 2, 2019
@Centril Centril added the O-linux Operating system: Linux label Apr 2, 2019
@Enselic Enselic added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

4 participants