-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
TracerProvider allows calling Tracer() while it's shutting down #3924
TracerProvider allows calling Tracer() while it's shutting down #3924
Conversation
aeac359
to
735b1a2
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3924 +/- ##
=======================================
- Coverage 81.8% 81.7% -0.1%
=======================================
Files 170 170
Lines 12911 12943 +32
=======================================
+ Hits 10563 10577 +14
- Misses 2129 2143 +14
- Partials 219 223 +4
|
I think the first step in
In that case there would not be a way for a |
2416e32
to
ff9fee7
Compare
@Aneurysm9 This makes sense, thanks! I've changed the code accordingly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to avoid deadlocks, I believe the double-checked locking is needed in all exported methods (similarly to Tracer()
) as all of them can be used within Shutdown()
(or UnregisterSpanProcessor()
) via external code (sp.Shudown()
and otel.Handle()
)
Leaving the decission for #3924 (comment) to the maitainers
ff9fee7
to
133cd0d
Compare
133cd0d
to
9e712cf
Compare
9e712cf
to
3a8d297
Compare
3a8d297
to
a44fa69
Compare
a44fa69
to
f07c478
Compare
Fixes #3890.
I decided to introduce a separate mutex to decouple
Tracer()
from ALL other methods. I think this is way more robust than trying to release locks early, etc. Releasingmu
early would have unintended, potentially undesirable effect of allowingRegister
/Unregister
vsShutdown
to be unblocked earlier, while a concurrent call is still running. It may be hard to use the tracer provider in some scenarios if it works like that. It may be fine, but I think this is very subtle and can be undesirable behavior.I've also moved logging out of the protected section just to be sure no external code can be called while holding the lock to avoid any chance of deadlock.