-
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
fix(prof): add missing "in-preloading" check to RSHUTDOWN
#3037
Conversation
RSHUTDOWN
RSHUTDOWN
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3037 +/- ##
=========================================
Coverage 74.80% 74.80%
Complexity 2781 2781
=========================================
Files 112 112
Lines 11017 11017
=========================================
Hits 8241 8241
Misses 2776 2776
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry.
|
631d4ff
to
1000e1c
Compare
Benchmarks [ profiler ]Benchmark execution time: 2025-01-14 16:11:40 Comparing candidate commit 5fced85 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 28 metrics, 8 unstable metrics. |
1000e1c
to
8edc030
Compare
`RSHUTDOWN` was missing the "in-preloading" check which would lead to a situation where some profilers would collect data even though in preloading. In allocation profiling this would lead to a situation where if a customer has a custom memory handler (or uses `USE_ZEND_ALLOC=0`) the allocation profiler would crash in `allocation::alloc_prof_rshutdown()` when trying to reset the heap.
8edc030
to
5fced85
Compare
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.
We went over the code together and the change looks good to us. The side-effects are a bit hard to reason about, maybe we can think of a way to represent invariants we need in code to help communicate these better in the future.
RSHUTDOWN
RSHUTDOWN
Description
The profiler may crash when:
USE_ZEND_ALLOC
to0
.The profiler is not supposed to collect samples during preloading for technical reasons. However,
RSHUTDOWN
was missing the "in-preloading" check which would lead to a situation where some profile types could collect data even though in preloading. In allocation profiling, this would lead to a situation where if a customer has a custom memory handler (or usesUSE_ZEND_ALLOC=0
) the allocation profiler would crash inallocation::alloc_prof_rshutdown()
when trying to reset the heap:dd-trace-php/profiling/src/allocation.rs
Lines 273 to 274 in 46258ca
Only the allocation profile types are known to be affected; the other types avoided this issue through other guards.
Reviewer checklist