-
Notifications
You must be signed in to change notification settings - Fork 12.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
Use #[track_caller] for no_threads.rs for Mutex #126050
base: master
Are you sure you want to change the base?
Conversation
Sorry for the lack of context, but I'm experiencing a terrible issue which is made significantly harder to debug as a result of this not being marked as `#[tracked_caller]`.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @cuviper (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
Have you tested this? I think it will just point you to the caller here instead: rust/library/std/src/sync/mutex.rs Line 317 in c1dba09
|
I have not had the opportunity to test this. I haven't set up Rust to compile on my set up. I haven't done it before, but I wanted to get the conversation started on this since it dramatically impacts the understandability of errors in my runtime environment. If we put track_caller only on the parent, will we be able to truncate all nested stack traces? How would you recommend making these choices for the project? |
I don't think We usually manage that backtrace report ourselves, and |
If we simply put track_caller into these two mentioned places, then the WASM debugging experience becomes much better for this mutex issue. I discussed this exact issue with another member in my Rust community, and they recognized this as helpful for the same kind of issues I experienced. So, how can this tradeoff be evaluated? Am I correct that the options are:
Thanks for the insights so far! I figured out that in my codebase, when I compile in release mode, there is no lock contention, so that's my current solution, as it's the easiest way. |
The panic message and the stack trace are orthogonal, even though they're both dealing with code locations.
Again, this won't change the stack trace at all, only the location given in the panic message. Here's a playground you can try with this code: fn main() {
foo();
}
#[track_caller]
fn foo() {
bar();
}
#[track_caller]
fn bar() {
panic!();
} If you change those
Your WASM runtime is even further divorced from this. Does it let you see any further in the stack than your screenshot showed? It did show That said, improving the panic message may still be worthwhile, as long as we don't hurt performance in general. Can you go ahead and add the second location? Then I'll queue a test build and perf run. |
Also, this seems weird. Release mode shouldn't have such visible effects on lock recursion, unless you have some code that's explicitly only grabbing a lock in debug mode. |
Sorry for the lack of context, but I'm experiencing a terrible issue which is made significantly harder in browser WASM to debug as a result of this not being marked as
#[tracked_caller]
.