-
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): avoid dlclose if threads did not join #3075
Conversation
If the PHP engine dlclose's the handle and the shared object is unloaded while another thread is running, we've hit undefined behavior. This also probably results in a crash (on platforms that unload instead of no-op). This may be the source of a crash when php-fpm does a log rotate. When doing the rotate, php-fpm shuts down all workers. If a worker is slow to process an upload and the timeout is hit, then we could hit this issue.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3075 +/- ##
============================================
+ Coverage 72.95% 74.74% +1.79%
Complexity 2790 2790
============================================
Files 139 112 -27
Lines 15280 11042 -4238
Branches 1047 0 -1047
============================================
- Hits 11147 8253 -2894
+ Misses 3580 2789 -791
+ Partials 553 0 -553
Flags with carried forward coverage won't be shown. Click here to find out more. see 27 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Benchmarks [ profiler ]Benchmark execution time: 2025-02-10 05:57:08 Comparing candidate commit 0c5b86e in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 28 metrics, 8 unstable metrics. |
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 @morrisonlevi ❤️
Description
Null out the extension's handle if the ddprof_upload or ddprof_time threads timeout instead of joining. If the PHP engine dlclose's the handle and the shared object is unloaded while another thread is running, we've hit undefined behavior. This also probably results in a crash (on platforms that unload instead of no-op).
This may be the source of a crash when php-fpm does a log rotate. When doing the rotate, php-fpm shuts down all workers. If a worker is slow to process an upload and the timeout is hit, then we could hit this issue.
Reviewer checklist