You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If ptrace_scope=1, since pid is None, PR_SET_PTRACER is never called. The sidecar then cannot ptrace the crashed process's threads.
The fix is to resolve the peer process's PID using getsockopt(SO_PEERCRED) on the Unix socket fd, then call PR_SET_PTRACER with that PID.
Motivation
I noticed that all PHP crash reports (schema 1.7) have error.threads with 0 frames per thread. Thread names are present (ddprof_time, ddprof_upload), but stacks are empty with incomplete: false. This affects 100% of PHP crashes. Ruby and Python are unaffected.
Additional Notes
Anything else we should know when reviewing?
How to test the change?
Describe here in detail how the change can be validated.
This report tracks Clippy allow annotations for specific rules, showing how they've changed in this PR. Decreasing the number of these annotations generally improves code quality.
❌ Patch coverage is 13.33333% with 91 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.52%. Comparing base (582bee1) to head (04b8385). ⚠️ Report is 1 commits behind head on main.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
In crash_handler.rs, PR_SET_PTRACER is only called when receiver.handle.pid is
Some:PHP connects to a pre-existing sidecar process using a Unix socket (
optional_unix_socket_filename).In receiver_manager.rs, the from_socket() path creates a ProcessHandle with pid: None:
If
ptrace_scope=1, since pid isNone,PR_SET_PTRACERis never called. The sidecar then cannot ptrace the crashed process's threads.The fix is to resolve the peer process's PID using
getsockopt(SO_PEERCRED)on the Unix socket fd, then callPR_SET_PTRACERwith that PID.Motivation
I noticed that all PHP crash reports (schema 1.7) have error.threads with 0 frames per thread. Thread names are present (
ddprof_time,ddprof_upload), but stacks are empty with incomplete: false. This affects 100% of PHP crashes. Ruby and Python are unaffected.Additional Notes
Anything else we should know when reviewing?
How to test the change?
Describe here in detail how the change can be validated.