feat: detect recursive calls that can deadlock HierarchicalLayer#82
feat: detect recursive calls that can deadlock HierarchicalLayer#82oli-obk merged 2 commits intodavidbarsky:mainfrom
HierarchicalLayer#82Conversation
|
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 thebufsmutex.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
rustcso it might be hidden behind a feature flag or some configuration?