-
Notifications
You must be signed in to change notification settings - Fork 161
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): crash on PHP 8.4 #3019
Conversation
It may be why CI is dying when linking
On PHP 8.4, the cache slots for internal and userland functions are separate.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3019 +/- ##
=========================================
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.
|
Benchmarks [ profiler ]Benchmark execution time: 2025-01-07 16:39:18 Comparing candidate commit 5e6e8ca in PR branch Found 2 performance improvements and 0 performance regressions! Performance is the same for 26 metrics, 8 unstable metrics. scenario:php-profiler-exceptions-control
scenario:walk_stack/1
|
profiling/src/php_ffi.c
Outdated
#if PHP_VERSION_ID >= 80400 | ||
// On PHP 8.4+, the internal cache slots need to be registered separately | ||
// from the user ones. | ||
_internal_run_time_cache_handle = | ||
zend_get_op_array_extension_handles(module_name, 2); |
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.
You meant to call zend_get_internal_function_extension_handle here? You're calling op_array again.
Signed-off-by: Bob Weinand <[email protected]>
963ceb6
to
ccae26d
Compare
Description
Fixes #3012. The profiler may crash when:
Note that for a variety of reasons, applications do not seem to crash as often as you might expect when reading the cause below as well as the attached patch. Nonetheless, every application which meets these conditions should upgrade to v1.6.0 or newer.
Cause and Fix
The cause is from a change in PHP 8.4 that was missed. The internals upgrading guide says:
This
run_time_cache_slot
is used while walking the call stack in the profiler. So if the profiler takes a sample when an internal function is on the call stack, then it will use anop_array_extension_handle
instead of theinternal_function_extension_handle
. The fix is to callzend_get_internal_function_extension_handle
as well and use that handle instead of the user handle when accessing the run time cache for internal functions.Reviewer checklist