-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Segfault in std::sync::mpmc::waker::SyncWaker::notify
#113726
Comments
relevant code rust/library/core/src/sync/atomic.rs Line 2540 in ad96323
|
@arthurprs does your code contain any |
Yes there are a few instances of unsafe, all guarded by debug assertions and such and this is running in debug mode. But I guess it's possible... My understanding is that this happens during drop of rust/library/std/src/sync/mpmc/waker.rs Line 170 in ad96323
Which theoretically was put there by a waiting receiver. |
Does this problem exist in both std mpsc and crossbeam? Or only in std mpsc? If the latter, the current std mpsc's try_select appears to be based on crossbeam 0.5.2 or 0.5.3 that is affected by compiler or std or OS bug related to TLS access, so changing it may fix the problem. crossbeam-rs/crossbeam#802 |
@taiki-e I left my "repro loop" running for like 1h, and it doesn't seem to fail with crossbeam, only std mpsc (within a minute). Looking at the code I can't tell how the TLS bug would lead to a segfault, but I'm not familiar with the codebase. |
WG-prioritization assigning priority (Zulip discussion). If I understand, a MCVE would help. @arthurprs am I correct in assuming the codebase is not publicly available? Also, to clarify, you are not reporting a regression, so there's no "good rustc" that doesn't reproduce the issue, correct? @rustbot label -I-prioritize +P-high +E-needs-mcve |
@apiraino that's correct. I tried, but couldn't successfully write a MCVE. What I was using to "reproduce" was calling the app test suite in a bash loop. |
Avoid tls access while iterating through mpsc thread entries Upstream fix: crossbeam-rs/crossbeam#802. Possibly fixes rust-lang/rust#113726.
Avoid tls access while iterating through mpsc thread entries Upstream fix: crossbeam-rs/crossbeam#802. Possibly fixes rust-lang/rust#113726.
I have code that resembles the following in my application. I'm trying to write a reproduction code, but so far no luck.
I expected to see this happen:
That it works reliably
Instead, this happened:
Very rarely I get a segfault, but when I do, gdb always shows the following stack trace
Meta
rustc --version --verbose
:I could also see it with
rustc 1.72.0-nightly (f7ca9df69 2023-06-24)
The text was updated successfully, but these errors were encountered: