Repository navigation
fix(profiling): keep fast-copy intent across faulthandler during warmup [backport 4.17] - #21723
Conversation
…up (#21230) ## Description 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). ## Testing * new unit tests (faulthandler during warmup; fork during warmup) ## Risks None. ## Additional Notes Stack: **1/3** (includes mid-warmup fork pin). Next: sticky foreign takeover (#21232). https://datadoghq.atlassian.net/browse/PROF-15995 ## Pre-review checklist - [ ] 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) Co-authored-by: Vlad Scherbich <vlad.scherbich@datadoghq.com>
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. |
Dependency direction analysis
|
Codeowners resolved asResolved from the full PR diff against |
There was a problem hiding this comment.
More details
Source inspection supports preserving fast-copy intent through warmup, faulthandler changes, and fork restarts while retaining safeguards for foreign signal handlers. Runtime behavior remains unverified.
🤖 Bits Code Review · Commit d71edc0
BenchmarksBenchmark execution time: 2026-11-12 17:43:09 Comparing candidate commit d71edc0 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 587 metrics, 9 unstable metrics, 1 flaky benchmarks without significant changes.
|
…up [backport 4.15] (#21240) ## Description Backport of #21230 to 4.15 (same squash as #21723). Cherry-pick `c1198df465`. Conflict in `sampler.cpp`: kept 4.15's foreign-handler log lines (no ownership APIs on this branch); took PR1's `seed_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 Manual rewrite onto current `4.15` after the automated/draft tip went DIRTY. ## Pre-review checklist - [ ] The changes have been tested in real services in staging - [ ] The PR does not result in new crashes
Backport #21230 to 4.17
https://datadoghq.atlassian.net/browse/PROF-15995