Skip to content

fix(profiling): placement new for all containers post fork#18560

Open
KowalskiThomas wants to merge 2 commits into
mainfrom
kowalski/fix-profiling-placement-new-for-all-containers-post-fork
Open

fix(profiling): placement new for all containers post fork#18560
KowalskiThomas wants to merge 2 commits into
mainfrom
kowalski/fix-profiling-placement-new-for-all-containers-post-fork

Conversation

@KowalskiThomas

@KowalskiThomas KowalskiThomas commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes more, even rarer post-fork crashes detected through Crash Logs (< 10 per day).

The fix is to "hard reset" with a placement-new instead of clear or whatever the "usual" way to reset is. The reason (still) is that the Sampling Thread may be mid-sampling / mid heap operation when the fork happens, in which case the STL containers we use may be left in an inconsistent state in the child process where the previously-working thread doesn't exist anymore.

@KowalskiThomas KowalskiThomas added the Profiling Continous Profling label Jun 10, 2026
@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codeowners resolved as

releasenotes/notes/profiling-fix-post-fork-crashes-00cc0d66244567c2.yaml  @DataDog/apm-python

@datadog-official

datadog-official Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 8 Pipeline jobs failed

DataDog/apm-reliability/dd-trace-py | build linux serverless: [amd64, cp315-cp315, v113741238-d2b8243-manylinux2014_x86_64, 1]   View in Datadog   GitLab

DataDog/apm-reliability/dd-trace-py | build linux serverless: [amd64, cp315-cp315, v113741491-d2b8243-musllinux_1_2_x86_64, 1]   View in Datadog   GitLab

DataDog/apm-reliability/dd-trace-py | build linux serverless: [arm64, cp315-cp315, v113741357-d2b8243-manylinux2014_aarch64, 1]   View in Datadog   GitLab

View all 8 failed jobs.

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🔄 Datadog auto-retried 1 job - 1 passed on retry View in Datadog

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 4776cfb | Docs | Datadog PR Page | Give us feedback!

@KowalskiThomas KowalskiThomas force-pushed the kowalski/fix-profiling-placement-new-for-all-containers-post-fork branch 2 times, most recently from a8afc07 to 53d46ab Compare June 10, 2026 12:35
@github-actions

Copy link
Copy Markdown
Contributor

This change is marked for backport to 4.10 and it does not conflict with that branch.
The command used to test backporting was

git fetch origin 4.10 && git checkout origin/4.10 && git checkout -b backport--to-4.10 && git cherry-pick -x --mainline 1 18acf341a05695c534ae3a4ae883ef578a451b7a

@github-actions

Copy link
Copy Markdown
Contributor

This change is marked for backport to 4.8 and it does not conflict with that branch.
The command used to test backporting was

git fetch origin 4.8 && git checkout origin/4.8 && git checkout -b backport--to-4.8 && git cherry-pick -x --mainline 1 18acf341a05695c534ae3a4ae883ef578a451b7a

@github-actions

Copy link
Copy Markdown
Contributor

This change is marked for backport to 4.11 and it does not conflict with that branch.
The command used to test backporting was

git fetch origin 4.11 && git checkout origin/4.11 && git checkout -b backport--to-4.11 && git cherry-pick -x --mainline 1 18acf341a05695c534ae3a4ae883ef578a451b7a

@github-actions

Copy link
Copy Markdown
Contributor

This change is marked for backport to 4.9 and it does not conflict with that branch.
The command used to test backporting was

git fetch origin 4.9 && git checkout origin/4.9 && git checkout -b backport--to-4.9 && git cherry-pick -x --mainline 1 18acf341a05695c534ae3a4ae883ef578a451b7a

@KowalskiThomas KowalskiThomas force-pushed the kowalski/fix-profiling-placement-new-for-all-containers-post-fork branch from 1067a44 to 4776cfb Compare June 10, 2026 12:59
@KowalskiThomas

Copy link
Copy Markdown
Contributor Author

@codex review

@KowalskiThomas KowalskiThomas marked this pull request as ready for review June 10, 2026 13:48
@KowalskiThomas KowalskiThomas requested review from a team as code owners June 10, 2026 13:48

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4776cfb81e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ddtrace/internal/datadog/profiling/stack/src/sampler.cpp
@gyuheon0h

Copy link
Copy Markdown
Contributor

Should we add identified by crashtracker if it was ID by crash logs

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants