-
Notifications
You must be signed in to change notification settings - Fork 160
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
Do not check get_DD_TRACE_ENABLED() outside of a request #2631
Conversation
get_DD_TRACE_ENABLED() must not be accessed outside of requests, given that it accesses a request local array of configs. DDTRACE_G(active_stack) is supposed to be always properly reset between requests, so we can just put this first and then the calls to get_DD_TRACE_ENABLED() are always correct. Fixes a crash in datadog_profiling::timeline::timeline_mshutdown doing collect_idle() and ultimately accessing the profiling_context here.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2631 +/- ##
============================================
- Coverage 78.67% 76.49% -2.18%
Complexity 2198 2198
============================================
Files 199 130 -69
Lines 21955 13095 -8860
Branches 0 986 +986
============================================
- Hits 17273 10017 -7256
+ Misses 4682 2552 -2130
- Partials 0 526 +526
Flags with carried forward coverage won't be shown. Click here to find out more. see 132 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
BenchmarksBenchmark execution time: 2024-04-17 17:28:04 Comparing candidate commit e6caca9 in PR branch Found 1 performance improvements and 1 performance regressions! Performance is the same for 176 metrics, 0 unstable metrics. scenario:ContextPropagationBench/benchInject64Bit
scenario:TraceSerializationBench/benchSerializeTrace
|
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.
Thank you for this PR. We should definitely write down some of this knowledge on conditional checking order in a code comment so it is not forgotten.
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.
Does it make any sense to fetch DDTRACE_G(active_stack) && DDTRACE_G(active_stack)->root_span
from mshutdown? I think we may need to avoid any call to this function after post-request shutdown or so.
These globals are valid until gshutdown actually, so it's fine. |
get_DD_TRACE_ENABLED() must not be accessed outside of requests, given that it accesses a request local array of configs.
DDTRACE_G(active_stack) is supposed to be always properly reset between requests, so we can just put this first and then the calls to get_DD_TRACE_ENABLED() are always correct.
Fixes a crash in datadog_profiling::timeline::timeline_mshutdown doing collect_idle() and ultimately accessing the profiling_context here.
Not sure how to test this; it was reported with the pretty obvious backtrace by an user.