-
Notifications
You must be signed in to change notification settings - Fork 39
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
BraveScopeManager not thread safe? #70
Comments
which readme are you referring to? Since there are no base test classes for us to inherit, I suppose making a test based on your example is one way to figure out what is going on. Regardless I'd expect that the executor would need to be instrumented to propagate the calling scope. In normal brave this is CurrentTraceContext.wrap(blah). Maybe you can ask @pavolloffay @CodingFabian or someone else from opentracing to clarify what this readme is saying and why it isn't wrapping the executor service (assuming it isn't) |
@adriancole I am pretty sure @mpetazzoni is referring to the OpenTracing Java project's README here. |
thanks.. I notice this at the bottom, which should be at the top as
the README encourages something usually not done manually
"In practice, all of this is most fluently accomplished through the
use of an OpenTracing-aware ExecutorServiceand/or Runnable/Callable
adapter; they factor out most of the typing."
At any rate thanks, for the context on this.
|
@adriancole I was indeed talking about
Feels to me like |
I don't think for a second what they document is a best practice.. it is
simply what they document. Anyway, I will look later to attempt to ensure
documented malpractice works.
|
I've opened opentracing/opentracing.io#258 to remove Zipkin from the supported tracer list as the people writing these READMEs (and the code in question) and promote opentracing do not help, and in lieu of that leave burden for others to clean it up
|
This also unsupports setting a custom ScopeManager as the api is hairy. Fixes #70
#71 yanks the faulty implementation |
This also unsupports setting a custom ScopeManager as the api is hairy. Fixes #70
v0.30.0 on the way with this |
Awesome, thanks! I'll check it out. |
I'm trying to pass a
Span
from one thread to another, as described in the README's "Deferring asynchronous work" section. Unfortunately, I think I'm running into a thread safety bug inBraveScopeManager
, in particular ingetOrEstablishActiveSpan()
.In the following code:
The active scope seen in thread B is sometimes
null
(while I expect it to bes2
). I believe this happens if thread B activates the span before thread A closes its scopes1
, leading tos2 == s1
in thread B.This of course does not happen if I simply create a child span in thread B with
tracer.buildSpan("bar").asChildOf(span)
, because that gets a different span ID and therefore a different entry in theactiveSpans
map of theBraveScopeManager
:I'm not sure what the best practice is here, or even whether this is a bug or a feature of the
BraveScopeManager
. But as-is, I believe the example in the README isn't a reliable way to pass tracing context to the async routine.(Thanks @isaachier for the help looking into this!)
The text was updated successfully, but these errors were encountered: