-
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
A thread can stop execution without dropping its packet #124466
Comments
@rustbot claim |
fuzzypixelz
added a commit
to fuzzypixelz/rust
that referenced
this issue
Feb 23, 2025
…oin` There is a time window during which the OS can terminate a thread before stdlib can retreive its `Packet`, see rust-lang#124466.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Feb 27, 2025
…ubilee Return unexpected termination error instead of panicing in `Thread::join` There is a time window during which the OS can terminate a thread before stdlib can retreive its `Packet`. Currently the `Thread::join` panics with no message in such an event, which makes debugging difficult; fixes rust-lang#124466.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Feb 27, 2025
…ubilee Return unexpected termination error instead of panicing in `Thread::join` There is a time window during which the OS can terminate a thread before stdlib can retreive its `Packet`. Currently the `Thread::join` panics with no message in such an event, which makes debugging difficult; fixes rust-lang#124466.
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Feb 28, 2025
Rollup merge of rust-lang#137480 - fuzzypixelz:fix/124466, r=workingjubilee Return unexpected termination error instead of panicing in `Thread::join` There is a time window during which the OS can terminate a thread before stdlib can retreive its `Packet`. Currently the `Thread::join` panics with no message in such an event, which makes debugging difficult; fixes rust-lang#124466.
github-actions bot
pushed a commit
to tautschnig/verify-rust-std
that referenced
this issue
Mar 6, 2025
There is a time window during which the OS can terminate a thread before stdlib can retreive its `Packet`. Currently the `Thread::join` panics with no message in such an event, which makes debugging difficult; fixes rust-lang#124466.
github-actions bot
pushed a commit
to thanhnguyen-aws/verify-rust-std
that referenced
this issue
Mar 6, 2025
There is a time window during which the OS can terminate a thread before stdlib can retreive its `Packet`. Currently the `Thread::join` panics with no message in such an event, which makes debugging difficult; fixes rust-lang#124466.
github-actions bot
pushed a commit
to tautschnig/verify-rust-std
that referenced
this issue
Mar 11, 2025
There is a time window during which the OS can terminate a thread before stdlib can retreive its `Packet`. Currently the `Thread::join` panics with no message in such an event, which makes debugging difficult; fixes rust-lang#124466.
github-actions bot
pushed a commit
to tautschnig/verify-rust-std
that referenced
this issue
Mar 11, 2025
…ubilee Return unexpected termination error instead of panicing in `Thread::join` There is a time window during which the OS can terminate a thread before stdlib can retreive its `Packet`. Currently the `Thread::join` panics with no message in such an event, which makes debugging difficult; fixes rust-lang#124466.
github-actions bot
pushed a commit
to tautschnig/verify-rust-std
that referenced
this issue
Mar 11, 2025
There is a time window during which the OS can terminate a thread before stdlib can retreive its `Packet`. Currently the `Thread::join` panics with no message in such an event, which makes debugging difficult; fixes rust-lang#124466.
github-actions bot
pushed a commit
to tautschnig/verify-rust-std
that referenced
this issue
Mar 11, 2025
…ubilee Return unexpected termination error instead of panicing in `Thread::join` There is a time window during which the OS can terminate a thread before stdlib can retreive its `Packet`. Currently the `Thread::join` panics with no message in such an event, which makes debugging difficult; fixes rust-lang#124466.
github-actions bot
pushed a commit
to model-checking/verify-rust-std
that referenced
this issue
Mar 11, 2025
There is a time window during which the OS can terminate a thread before stdlib can retreive its `Packet`. Currently the `Thread::join` panics with no message in such an event, which makes debugging difficult; fixes rust-lang#124466.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Context
A thread holds a reference to a
Packet
object which it uses to send its result back to thread which holds itsJoinHandle
.It's possible for the thread to enter a signaled state and stop its execution without reaching the point where is drops its packet (or return a result at all).
On the other hand, the implementation of
JoinHandle::join
is the following:The first
.unwrap()
assumes that the thread stopped execution normally, which leads to cryptic panic errors it eventually fails.How to reproduce this?
One way of reproducing this is to have a Windows DLL with a
libc::atexit
handler that joins thread created in the main application. If the application exits before the thread finishes execution, the there is a high change the above.unwrap()
fails. Otherwise no panic will be observed:Compile the above
test.c
and link to thelib.rs
DLL, then run the following:Unfold output of the above script
This example is available in https://github.com/fuzzypixelz/rust-thread-race-condition. There is a simple workflow that can reproduce the above output on
windows-2022
runners.What to do about it?
I think a low hanging fruit here is replacing the
.unwrap()
with a terse.expect(...)
error message.The text was updated successfully, but these errors were encountered: