Skip to content

fix(profiling): re-run fast-copy warmup after mid-warmup fork - #21231

Closed
vlad-scherbich wants to merge 3 commits into
vlad/fastcopy-1-warmup-faulthandlerfrom
vlad/fastcopy-2-warmup-fork
Closed

vlad-scherbich wants to merge 3 commits into
vlad/fastcopy-1-warmup-faulthandlerfrom
vlad/fastcopy-2-warmup-fork

Conversation

@vlad-scherbich

@vlad-scherbich vlad-scherbich commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

If this PR merges alone on top of PR1: a child forked mid-warmup re-runs the warmup decision and can upgrade to safe_memcpy, instead of inheriting fast_copy_active == false for life (gunicorn/celery prefork shape).

Mechanism (fast_copy_desired) is already on the base branch. This PR adds the regression pin and expands the release note to cover fork during warmup.

Layer Meaning Which PR in the stack?
Compiled into artifact unchanged vs PR1 —
Armed at runtime child re-warmup via desired (PR1) pinned here
Observable in product/Python reno covers fork this PR

Testing

Risks

Additional Notes

Stack: 2/4 (base PR1). Next: sticky foreign takeover.

Pre-review checklist

  • The changes have been tested in real services in staging
  • The PR does not result in new crashes

https://datadoghq.atlassian.net/browse/PROF-16018

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codeowners resolved as

Resolved from the full PR diff against vlad/fastcopy-1-warmup-faulthandler using the target branch CODEOWNERS file.
CODEOWNERS team requests not listed below are not required by the current file set.

releasenotes/notes/profiling-fast-copy-mid-warmup-fork-15886547dcf91a47.yaml  @DataDog/apm-python
tests/profiling/collector/test_copy_memory_stats.py                     @DataDog/profiling-python

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Dependency direction analysis

⚠️ Existing dependency direction violations

There are 77 dependency direction violations that already exist on the base branch and have not been changed by this PR.

Show existing violations (showing 5 of 77 highest severity)
ddtrace.internal.tracemethods -×-> ddtrace.trace  (internal-core -> product:tracing, score=120)
ddtrace.llmobs._integrations.base -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=118)
ddtrace.llmobs._integrations.langchain -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=118)
ddtrace.llmobs._integrations.litellm -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=118)
ddtrace.llmobs._integrations.openai_agents -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=118)

To see all violations, download the layers-base.json and layers-pr.json artifacts from this CI job and run:

uv run --script scripts/import-analysis/layers.py compare layers-base.json layers-pr.json

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused regression test matches the existing child-sampler restart behavior, and the release note accurately describes the covered fix.

No open issues 🎉

What changed in this PR

This PR adds regression coverage for the existing profiler behavior that restarts fast-copy warmup in a child process forked during warmup. It does not change runtime code.

Changes:

  • Adds a subprocess test verifying that the child eventually upgrades to safe_memcpy.
  • Expands the release note to include forks during startup warmup.
File Description
tests/​profiling/​collector/​test_copy_memory_stats.py Adds regression coverage for fast-copy recovery after a mid-warmup fork.
releasenotes/​notes/​profiling-fast-copy-warmup-fork-3f1c8a4d92b7e05a.yaml Documents the fork-related fix alongside the existing faulthandler fix.

Review effort: Balanced

@datadog-prod-us1-3

datadog-prod-us1-3 Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Pipelines  Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 025d3bb | Docs | View more details | Give us feedback!

@vlad-scherbich
vlad-scherbich force-pushed the vlad/fastcopy-2-warmup-fork branch 2 times, most recently from 916a0bb to ac8f88c Compare October 26, 2026 00:49
@vlad-scherbich
vlad-scherbich requested review from a team and gyuheon0h and a balanced review from Copilot October 26, 2026 00:50
@vlad-scherbich
vlad-scherbich requested a balanced review from Copilot and removed request for Copilot October 26, 2026 00:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Static review found no blocking issues in this focused test-and-documentation change; tests were not executed during review.

No open issues 🎉

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused regression test and release note match the existing behavior, with no blocking issues identified; tests were not executed in this review environment.

No open issues 🎉

Review effort: Balanced

A child forked during warmup inherited fast_copy_active == false and never
upgraded. Prefork workers hit this window. Pin the child upgrade path; the
desired-flag mechanism is already on the base branch.
Keep the faulthandler note on the base PR file; claim only the fork delta here.
@vlad-scherbich
vlad-scherbich force-pushed the vlad/fastcopy-2-warmup-fork branch from f3c4009 to dcea083 Compare November 9, 2026 19:56
@vlad-scherbich

vlad-scherbich commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Superseded by folding the mid-warmup fork test + reno into #21230. Closing this PR; no human review time was spent on this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Profiling Continous Profling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants