-
Notifications
You must be signed in to change notification settings - Fork 597
fix: return current context in on_end instead of causing panic #3262
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3262 +/- ##
=======================================
- Coverage 80.8% 80.8% -0.1%
=======================================
Files 129 129
Lines 23203 23212 +9
=======================================
+ Hits 18750 18756 +6
- Misses 4453 4456 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
bantonsson
left a comment
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.
Hi @taisho6339 and thank you for the PR. I have a few comments about the doc and solution.
I will close and reopen the PR to try to start our CI benchmarks.
|
Closing and reopening to start benchmarks. |
97ad7e6 to
14b0e1b
Compare
|
Thank you @taisho6339. The Benchmark numbers look way better now (actually resulting in some benchmarks running faster). I don't see exactly these changes on my MBP M4 Max, but a degradation between 2 and 8 percent which is totally acceptable.
|
bantonsson
left a comment
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.
Looks good apart from the comment in the tests.
|
This needs a second review and merge @open-telemetry/rust-maintainers |
Fixes #2871
Problem
Context::current() panicked with "RefCell already mutably borrowed" when called from SpanProcessor::on_end during span cleanup. Root cause: ContextGuard::drop held a mutable borrow while dropping the context, which triggered Span::drop → on_end → Context::current() → panic.
Solution
Modified ContextGuard::drop to extract the context outside the borrow_mut() scope before dropping it:
Changes
Note
Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial, user-facing changes