dd-trace-php
dd-trace-php copied to clipboard
[profiling] Prevent deadlocks when forking
Description
Deadlocks are prevented by the following technique:
- Prior to the fork, all profiling threads will wait on the same barrier.
- After the fork in the parent process, all threads will wait on the same barrier. They are then free to resume regular operations.
- After the fork in the child process, the barrier will not be joined, the profiler object will be forgotten, and profiling will be disabled.
It should be easy to support profiling the child process from here.
Readiness checklist
- [ ] Changelog has been added to the release document.
- [ ] Tests added for this feature/bug.
Reviewer checklist
- [ ] Appropriate labels assigned.
- [ ] Milestone is set.