-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Print thread ID in panic message #115746
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
Print thread ID in panic message #115746
Conversation
r? @davidtwco (rustbot has picked a reviewer for you, use r? to override) |
I think this needs FCP since it's a visible change @rustbot label -T-libs -T-compiler +T-libs-api |
d68fab6
to
371dd28
Compare
The Miri subtree was changed cc @rust-lang/miri |
8e72037
to
3da1046
Compare
Maybe
or
? That fits more with the way named threads are shown. |
Note that this is a rust-internal thread ID, which isn't the OS thread ID which can be relevant if you're also logging from C code or looking at things with GDB. And |
I just proposed the syntax as a demo, figured libs-api would make the final choice - though between those two, I like the first one better
It is kind of unfortunate that Rust and C won't use the same thread IDs. But this seems worthwhile still - Rust-only applications printing the thread ID in logs is common ( This is all inspired by the below failure I recently had in an highly threaded system. The entire backtrace uselessly displayed one repeated function, with no hints about which preceding log events were relevant:
I don't think that stability of the thread ID is much of a concern since we will always have some integer ID for a thread, even if the semantics of that ID might change. The important thing is probably just that this panic message thread ID is the same as what shows up as |
Another display option - it looks a bit cleaner to not even call out that a thread is unnamed, and I don't think it adds much
Or we could use
I also tried to poke some discussion at #67939 |
☔ The latest upstream changes (presumably #115627) made this pull request unmergeable. Please resolve the merge conflicts. |
@joshtriplett do you have any thoughts on this? |
3da1046
to
e055544
Compare
Sorry to add bike shedding to the thread. Here is a slight derivative of the last suggestion, which omits a "with":
Although it's uglier than using the thread identifier in a sentence, using the Debug form makes it look like a Rust value rather than something else. It's also consistent with other output from Rust, although the case can definitely be made that thread IDs deserve a special case. |
I know Josh has a pretty busy queue, so perhaps it is best to reroll r? libs-api |
I think it wouldn't need one. T-libs-api FCP is primarily for any time a permanent API commitment is being made by the standard library, and deprecations. In contrast, anything that we can just change back with minimal effort or disruption would not warrant FCP. #112849 had a T-libs FCP but I am not familiar with their criteria for that. @rust-lang/libs would you want to handle this PR? In any case, this looks good to me. |
I don't know that this needs FCP. I'm not opposed and there is precedent for it, but OTOH we wouldn't FCP a panic message change somewhere in the stdlib. So I don't feel strongly. In any case, I think this change is a good idea, and am in favor. |
@bors r+ rollup=iffy |
So we don't need to add normalization to every test that includes a panic message, add a global normalization to compiletest.
`panic!` does not print any identifying information for threads that are unnamed. However, in many cases, the thread ID can be determined. This changes the panic message from something like this: thread '<unnamed>' panicked at src/main.rs:3:5: explicit panic To something like this: thread '<unnamed>' (0xff9bf) panicked at src/main.rs:3:5: explicit panic Stack overflow messages are updated as well. This change applies to both named and unnamed threads. The ID printed is the OS integer thread ID rather than the Rust thread ID, which should also be what debuggers print.
1fae81d
to
289fe36
Compare
This PR modifies |
Rebased in case we picked up some new tests that need adjustment, but from running locally it seems like this is still fine. @bors r=cuviper |
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 6bcdcc7 (parent) -> 61cb1e9 (this PR) Test differencesShow 5 test diffsStage 1
Additionally, 4 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 61cb1e97fcf954c37d0a457a8084ed9ad8b3cb82 --output-dir test-dashboard And then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
Finished benchmarking commit (61cb1e9): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -0.0%, secondary 3.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -2.7%, secondary 1.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.1%, secondary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 465.172s -> 464.27s (-0.19%) |
is there a way to disable this somehow?
|
There is not any way currently. It's probably possible but that's just an extra knob that we should probably avoid. Can you preprocess the text before saving or before deduplicating, like compiletest does rust/src/tools/compiletest/src/runtest.rs Lines 2570 to 2573 in 321a89b
|
rust-lang/rust#115746 changed to print thread ID so we update accordinly.
rust-lang/rust#115746 changed to print thread ID, so we update accordingly.
rust-lang/rust#115746 changed to print thread ID, so we update accordingly. See <https://github.com/rust-lang/cargo/actions/runs/16839675728/job/47707652618?pr=15821>
Fix wasm target build with atomics feature Introduced by rust-lang#115746 close rust-lang#145101
panic!
does not print any identifying information for threads that areunnamed. However, in many cases, the thread ID can be determined.
This changes the panic message from something like this:
To something like this:
Stack overflow messages are updated as well.
This change applies to both named and unnamed threads. The ID printed is
the OS integer thread ID rather than the Rust thread ID, which should
also be what debuggers print.
try-job: aarch64-apple
try-job: aarch64-gnu
try-job: dist-apple-various
try-job: dist-various-*
try-job: dist-x86_64-freebsd
try-job: dist-x86_64-illumos
try-job: dist-x86_64-netbsd
try-job: dist-x86_64-solaris
try-job: test-various
try-job: x86_64-gnu
try-job: x86_64-mingw-1
try-job: x86_64-msvc-1