-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
std::thread::spawn: thread-local storage panics #138696
Labels
C-bug
Category: This is a bug.
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
regression-untriaged
Untriaged performance or correctness regression.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
Comments
To restore previous behavior we need to have the way to spawn without going into hooks code. However, thread Builder's |
Fixed by #138702 |
Thanks! |
yellowhatter
added a commit
to ZettaScaleLabs/zenoh
that referenced
this issue
Mar 20, 2025
YuanYuYuan
added a commit
to eclipse-zenoh/zenoh
that referenced
this issue
Mar 24, 2025
* Make background close builder nolocal * make close builders internally-public * Update lib.rs * do not use flume channel s it is not nolocal * fix exports * switch runtime to Net * Make close more atexit-safe * add tests for wait() in close * Add important note * Update Cargo.toml and atexit.rs * Code format * fix clippy * Update Cargo.lock * - review fixes - get rid of async-channel (use tokio channel instead until it is nolocal) - improve testing coverage (test background close to be nolocal) * code format * fix feature set * disable session_close_in_atexit test on 1.85 as std has regression rust-lang/rust#138696 * fix tokio executor blockage * Paic with message describing nolocal thread spawning error * spelling * Handle nolocal errors more properly * refactor: replace `mpsc::channel` with `oneshot::channel` and address the `block_in_place` issue (#26) --------- Co-authored-by: Yuyuan Yuan <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: This is a bug.
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
regression-untriaged
Untriaged performance or correctness regression.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
Hello, rust-team!
Code
I tried this code:
I expected to see this happen: thread spawned normally
Instead, this happened: panic at
std::thread::spawnhook::run_spawn_hooks
because it tries to talk to TLS which is not available inside of atexit context. Earlier versions ofthread
didn't have this hooks functionality and were OK spawning insideatexit
and we tested it on Win, Mac and Linux.Functionality to spawn thread inside
atexit
is very important as it is a silver bullet workaround to execute some TLS-using code fromatexit
context.Version it worked on
It most recently worked on: at least 1.75
Version with regression
rustc --version --verbose
:Backtrace
Backtrace
The text was updated successfully, but these errors were encountered: