-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Mutex::new with tracing
feature enabled can prevent spans from closing
#6106
Comments
as a note, I think that this span is the one that needs to be changed. (an alternative that I drafted, but didn't send, would be to expose a separate constructor that accepts a span as an argument, but that defeats a large purpose of how |
It is indeed this span 👍 The other one gets exited and dropped within the I'll note that this issue isn't necessarily particular to |
Note that the
At the very least, I'm pretty confident that a PR to |
Yes 💯 , I was referring to this thinking this was another span, but this is a |
…a None parent instead A child span stored on the mutex can keep the parent span open, unable to be closed by subscribers due to the mutex referencing it. Fixes: tokio-rs#6106
…arent instead A child span stored on sync primitives can keep the parent span open, unable to be closed by subscribers due to the sync resource referencing it. Fixes: tokio-rs#6106
…arent instead A child span stored on sync primitives can keep the parent span open, unable to be closed by subscribers due to the sync resource referencing it. Fixes: tokio-rs#6106
Version
Description
I've been investigating an issue with some traces not getting closed in another repository and tracked it down to a
tokio::sync::Mutex
(withtracing
feature enabled).If a
Mutex
is created within the context of a particular parent trace, and then stored in memory to be reused in the context of other traces, it seems like that first parent span will never be closed, since the Mutex and its innerresource_span
holds a "reference" (incremented the ref_count of the trace) to the parent span. (This is while usingtracing-subscriber
as well).Here's a simple repro, of this "issue", if this is indeed an issue.
I chatted briefly about this with @davidbarsky, who mentioned the following:
From our usage, this seems to ring true. We have a request span that caches a mutex item for a particular request shape, and this trace remains open until the cache is cleared.
I'd be happy to submit a PR if this makes sense to you folks as well.
The text was updated successfully, but these errors were encountered: