-
Notifications
You must be signed in to change notification settings - Fork 31
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
feat: detect recursive calls that can deadlock HierarchicalLayer
#82
Conversation
lgtm. Tho it could use a test. lmk if you don't have time to add it, I'll give it a look then. |
I don't know how to test this. I would either have to make something that's already used log something. I didn't see anything like that when skimming it again. Otherwise, I'd need Alternatively, I could add a random So I'd be happy to add tests, but I'm not sure how to go about that here. |
Hmm... would it work if we used a custom tracing destination? (i.e. not the stderr default, but a custom writer, that will then just emit a tracing event once) |
You're right, that should work, I did not think of that. I'll try it out later today. |
we really should get |
I've added the test. I know usually |
Very nice! Thanks! |
Could you also make a release when you get some time? It should help the people in the linked |
done |
bump tracing Unpins `tracing`: linked issue looks fixed, tokio-rs/tracing#2635 referencing davidbarsky/tracing-tree#82 Perf run please, as changelog says about improvements https://github.com/tokio-rs/tracing/blob/tracing-0.1.40/tracing/CHANGELOG.md https://github.com/tokio-rs/tracing/blob/tracing-core-0.1.32/tracing-core/CHANGELOG.md
This should address tokio-rs/tracing#2635
If a
tracing::event!
is created while insideon_event
,on_new_span
, oron_close
, the code can deadlock because of thebufs
mutex.This patch ensures that there are no recursive calls when locking is used by using a thread local atomic boolean which signals whether the call is recursive or not.
This is a very specific feature accommodating usage in
rustc
so it might be hidden behind a feature flag or some configuration?