Repository navigation
fix(profiling): keep fast-copy intent across faulthandler during warmup [backport 4.16] - #21241
vlad-scherbich wants to merge 1 commit into
Conversation
Codeowners resolved asResolved from the full PR diff against |
Dependency direction analysis
|
Circular import analysis
|
BenchmarksBenchmark execution time: 2026-11-16 21:24:40 Comparing candidate commit 3c33f8d in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 16 metrics, 0 unstable metrics.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🎉 All green!🧪 All tests passed 🔗 Commit SHA: 3c33f8d | Docs | View more details | Give us feedback! |
There was a problem hiding this comment.
During warmup, a no-op faulthandler.disable() can overwrite handlers installed by a native library. This bypasses the intended syscall fallback and can corrupt the crash-handler chain.
🤖 Bits Code Review · Commit da94087
There was a problem hiding this comment.
More details
Preserved fast-copy intent allows coordinated faulthandler swaps during warmup to restore recovery handlers before fast-copy sampling resumes. Runtime behavior remains unverified.
🤖 Bits Code Review · Commit 71e5772
…up (#21230) Warmup clears `fast_copy_active` while our SIGSEGV handler is still installed. Handler install/uninstall/reclaim keyed off that flag, so `faulthandler.enable()` in the window took the handler unnoticed and the warmup deadline pinned the process to the syscall copy for life. This PR adds persistent `fast_copy_desired` (untouched by warmup), uses `fast_copy_handler_ops_enabled()` for those handler ops, and publishes `fast_copy_memory_desired` in internal metadata. It also pins the mid-warmup fork path: a child re-runs the warmup decision instead of inheriting `fast_copy_active == false` for life (gunicorn/celery prefork). * new unit tests (faulthandler during warmup; fork during warmup) None. Stack: **1/3** (includes mid-warmup fork pin). Next: sticky foreign takeover (#21232). https://datadoghq.atlassian.net/browse/PROF-15995 - [ ] The changes have been tested in real services in staging - [ ] The PR does not result in new crashes Co-authored-by: vlad.scherbich <vlad.scherbich@datadoghq.com> (cherry picked from commit c1198df)
e40d2b5 to
3c33f8d
Compare
Pull request was converted to draft
There was a problem hiding this comment.
More details
Separating fast-copy intent from its active state supports recovery after faulthandler coordination and forks during warmup. The completed static review identified no actionable regressions; runtime signal-handler behavior remains unverified.
🤖 Bits Code Review · Commit 3c33f8d
There was a problem hiding this comment.
More details
Static review identified no reportable defect in handler coordination during warmup or sampler restart after fork. Runtime behavior remains unverified because the checkout lacks built native extensions.
🤖 Bits Code Review · Commit 3c33f8d
Description
Backport of #21230 to 4.16 (same squash as #21723).
Cherry-pick
c1198df465. Conflict insampler.cpp: kept 4.16's foreign-handler log lines (no ownership APIs on this branch); took PR1'sseed_fast_copy_profiler_stats()+sampler_active_.store(false)on the no-fallback stop path.Testing
Unit tests from source for faulthandler-during-warmup and mid-warmup fork.
Risks
Same as #21230 / #21723.
Additional Notes
https://datadoghq.atlassian.net/browse/PROF-15995
Pre-review checklist