Skip to content

Prevent trace context from leaking between Pekko actor messages - #13767

Open
ygree wants to merge 2 commits into
masterfrom
ygree/pekko-mailbox-context-fix
Open

ygree wants to merge 2 commits into
masterfrom
ygree/pekko-mailbox-context-fix

Conversation

@ygree

@ygree ygree commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

Preserves per-message trace context in Pekko actors. A message sent under an active span inherits its parent through the envelope. A subsequent message sent without an active span starts a root span, even when the same mailbox run processes both messages.

Motivation

When a traced message schedules a mailbox, generic executor instrumentation can capture the sender’s context for the entire mailbox run. An untraced message processed in that run can then inherit the first message’s parent.

Additional Notes

The standard Pekko dispatcher mailbox is excluded from both RUNNABLE capture for thread-pool-executor and FORK_JOIN_TASK capture for fork-join-executor.

The regression test reproduced the leak with both executors on Pekko 1.0.0 and 1.7.1. With the exclusions in place, it passed on Java 8 and Java 25.

Ref: #13679

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@ygree ygree self-assigned this Dec 2, 2026
@ygree ygree added type: bug fix Bug fix inst: others All other instrumentations tag: ai generated Largely based on code generated by an AI or LLM labels Dec 2, 2026
@datadog-official

datadog-official Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 68.82% (+7.14%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 6713daa | Docs | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

🟡 Java Benchmark SLOs — Performance SLO warning (near threshold)

Suite Status
Startup 🟡 warning

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.92 s 14.83 s [-0.1%; +1.3%] (no difference)
startup:insecure-bank:tracing:Agent 13.64 s 13.77 s [-1.6%; -0.4%] (maybe better)
startup:petclinic:appsec:Agent 17.30 s 17.03 s [+0.9%; +2.4%] (maybe worse)
startup:petclinic:iast:Agent 17.22 s 17.21 s [-0.8%; +0.9%] (no difference)
startup:petclinic:profiling:Agent 17.05 s 16.88 s [-0.4%; +2.4%] (no difference)
startup:petclinic:sca:Agent 17.15 s 16.97 s [+0.2%; +2.0%] (maybe worse)
startup:petclinic:tracing:Agent 16.25 s 16.25 s [-0.8%; +0.8%] (no difference)

Commit: 6713daa7 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@ygree
ygree marked this pull request as ready for review December 2, 2026 02:41
@ygree
ygree requested review from a team as code owners December 2, 2026 02:41
@ygree
ygree requested review from bric3 and jordan-wong and removed request for a team December 2, 2026 02:41
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-02T02:45:09.860169Z 6713daa Draft marked ready
🔒 Security Review ✅ Completed 2026-12-02T02:44:53.705174Z 6713daa Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@datadog-official datadog-official Bot 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.

Bits Code Review: PASS

More details

The mailbox exclusions prevent sender context from spanning multiple messages while preserving envelope-based parenting for each message across both executor types.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 6713daa

This branch has not been deployed

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

Labels

inst: others All other instrumentations tag: ai generated Largely based on code generated by an AI or LLM type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant