-
Notifications
You must be signed in to change notification settings - Fork 836
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
Context leak if several TracerProvider instances are used #1932
Comments
I'm not sure this is an actual problem end user will face, having different |
I'm wondering if the same would happen with web tracer provider and zone context, what context provider are you using in node (we have 2), does it happen for both ? |
That's independent of Web/Node and which context manager is used. So in short a user of a non global Maybe it's even worse for |
that would also make all the context management methods be on the tracerprovider instead of global correct? after 1.0 it will not be possible to make changes like this so we will have to either document this as a known issue or fix it now. |
Not really as a I guess it would be needed to remove any defaulting to global context manager. I think the majority of users will be not effected as they will use one For the remaining users doc should help. Clearly state that they are responsible to pass context manually or use their |
I think it might be better to drop the multiple tracerprovider idea entirely. it is not required by the spec anymore and nothing in our docs says its supported. we can explicitly document it as unsupported |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
This issue was closed because it has been stale for 14 days with no activity. |
There are several places in our codebase where
context.active()
is used to fetch the current context from global ContextManager.I think this may be problematic as this easily results in "leaking" spans from one export chain into another. Following code illustrates this:
There two
TracerProvider
instances are used resulting in two independent export chains. But actually the span exported via "other" export chain refers to the "global" span as parent.Reason is that
startSpan()
usescontext.active()
therefore the global span becomes visible there.Only if other creates its own context manager and uses it everywhere they are independent.
Using it everywhere is actually hard as e.g.
BatchSpanProcessor
use global context internally to suppress their exports.There are several places in our samples/docs/API which illustrate that using more and non global
TracerProvider
is possible (e.g.InstrumentationAbstract.setTracerProvider()
,...)But to me it looks like this will result in unexpected behavior if this is actually done by users.
Propagator API seems to be not effected as it requires to pass in a context and global context is not used automatically.
I'm not really sure how to tackle this.
The text was updated successfully, but these errors were encountered: