-
Notifications
You must be signed in to change notification settings - Fork 167
fix(prof): use cached heap in alloc_prof_orig_* functions
#3547
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3547 +/- ##
=======================================
Coverage 62.02% 62.02%
=======================================
Files 140 140
Lines 13309 13309
Branches 1762 1762
=======================================
Hits 8255 8255
Misses 4265 4265
Partials 789 789 Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Benchmarks [ profiler ]Benchmark execution time: 2026-01-16 13:23:35 Comparing candidate commit 292ae88 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 29 metrics, 7 unstable metrics. |
61be8bf to
446ec2d
Compare
|
13d44b8 to
b389c65
Compare
A crash report indicated that `_zend_mm_alloc` was being called with an invalid heap pointer This invalid pointer originated from the call to `zend::zend_mm_get_heap()` within `alloc_prof_orig_alloc`.
b389c65 to
f2ddfd3
Compare
morrisonlevi
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.
Thanks for the explanation both here and on slack!
Description
A crash report ...
... with a
0x0si_addrindicated that_zend_mm_alloc()was being called with an invalid heap argument (beingNULLand not dangling). This pointer to the heap we pass to_zend_mm_alloc()originates from a call tozend::zend_mm_get_heap()withinalloc_prof_orig_alloc()in line 376:dd-trace-php/profiling/src/allocation/allocation_le83.rs
Lines 375 to 382 in ed3089e
This is weird and can only mean that "something" changed the current heap via
zend_mm_set_heap()after we installed our hooks inRINITtoNULL, but I could not find any other extension that are known for these kind of things in the crash report or thatsi_addrbeing0x0is misleading and for whatever reason this does not mean the fault address was0x0, but it means that the kernel when creating the signal was not able to determine the fault address.Either way: this got me thinking if fetching the current heap via
zend_mm_get_heap()is the right call anyway, because we need to forward the allocation to the heap that was alive when we installed our custom handlers for observing memory allocations and this is exactly what this PR does.Reviewer checklist