-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Band-aid fix to stop race conditions in llvm errors #45170
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a big hammer, but should be effective at completely removing a few issues, including inconsistent error messages and segfaults when LLVM workers race to report results LLVM_THREAD_LOCAL has been present in LLVM since 8 months before 3.7 (the earliest supported LLVM version that Rust can use) Maybe fixes #43402 (third time lucky?)
@bors: r+ Oh dear, that should definitely be a thread local! |
📌 Commit 8628d51 has been approved by |
@bors: p=1 |
bors
added a commit
that referenced
this pull request
Oct 10, 2017
…al, r=alexcrichton Band-aid fix to stop race conditions in llvm errors This is a big hammer, but should be effective at completely removing a few issues, including inconsistent error messages and segfaults when LLVM workers race to report results `LLVM_THREAD_LOCAL` has been present in LLVM since 8 months before 3.7 (the earliest supported LLVM version that Rust can use) Maybe fixes #43402 (third time lucky?) r? @alexcrichton ------ You can see that in https://github.com/rust-lang/rust/blob/5f578dfad0dd5d43b28eff71a7e857d10c3f55fe/src/librustc_trans/back/write.rs#L75-L100 there's a small window where the static global error message (made thread local in this PR) could be altered by another thread. Note that we can't use `thread_local` because gcc 4.7 (permitted according to the readme) does not support it. Maybe ideally all the functions should be modified to not use a global, but this PR makes things deterministic at least. My only hesitation is whether errors are checked in different threads to where they occur, but I figure that's probably unlikely (and is less bad than racing code). As an aside, segfault evidence before this patch when I was doing some debugging: ``` $ while grep 'No such file or directory' log2; do RUST_LOG=debug ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc -o "" y.rs >log2 2>&1; done error: could not write output to : No such file or directory error: could not write output to : No such file or directory error: could not write output to : No such file or directory error: could not write output to : No such file or directory error: could not write output to : No such file or directory error: could not write output to : No such file or directory error: could not write output to : No such file or directory Segmentation fault (core dumped) error: could not write output to : No such file or directory error: could not write output to : No such file or directory ```
☀️ Test successful - status-appveyor, status-travis |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a big hammer, but should be effective at completely removing a
few issues, including inconsistent error messages and segfaults when
LLVM workers race to report results
LLVM_THREAD_LOCAL
has been present in LLVM since 8 months before 3.7(the earliest supported LLVM version that Rust can use)
Maybe fixes #43402 (third time lucky?)
r? @alexcrichton
You can see that in
rust/src/librustc_trans/back/write.rs
Lines 75 to 100 in 5f578df
Note that we can't use
thread_local
because gcc 4.7 (permitted according to the readme) does not support it.Maybe ideally all the functions should be modified to not use a global, but this PR makes things deterministic at least. My only hesitation is whether errors are checked in different threads to where they occur, but I figure that's probably unlikely (and is less bad than racing code).
As an aside, segfault evidence before this patch when I was doing some debugging: