Skip to content

Fix startup deadlock with virtual threads - #12786

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
masterfrom
andrea.marziali/fix-virtual-thread-startup-deadlock
Oct 8, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
masterfrom
andrea.marziali/fix-virtual-thread-startup-deadlock

Conversation

@amarziali

Copy link
Copy Markdown
Contributor

What Does This Do

Tracer 1.67.0 can deadlock when the first untraced virtual thread loads VirtualThreadState inside mount(). The JVM’s instrumentation class-loading hook waits for mount transitions to finish, including the transition making that call.

Here we preload VirtualThreadState before installing the instrumentation. Add a fresh-process smoke test that starts a virtual thread without an active trace context.

Motivation

Additional Notes

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@amarziali amarziali added the type: bug fix Bug fix label Oct 8, 2026
@amarziali
amarziali requested review from a team as code owners October 8, 2026 09:52
@amarziali amarziali added the inst: java Core Java language instrumentation label Oct 8, 2026
@amarziali
amarziali requested review from AlexeyKuznetsov-DD and removed request for a team October 8, 2026 09:52
@amarziali amarziali added the tag: concurrency Virtual Threads, Coroutines, Async, RX, Executors label Oct 8, 2026
@amarziali
amarziali requested review from PerfectSlayer, bric3, mcculls and ygree and removed request for a team October 8, 2026 09:52
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T09:56:31.993960Z 6ca119b PR opened
🔒 Security Review ✅ Completed 2026-10-08T09:57:13.897249Z 6ca119b PR opened
ℹ️ 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.

@mcculls mcculls 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.

LGTM, thanks for the regression test

@amarziali
amarziali enabled auto-merge October 8, 2026 09:58

@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

VirtualThreadState is initialized before transformer installation, avoiding its first load during a virtual-thread mount transition. The fresh-process smoke test covers untraced virtual-thread startup with a bounded completion timeout.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 6ca119b · @DataDog review to ask questions

@datadog-official

This comment has been minimized.

@dd-octo-sts

dd-octo-sts Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

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 13.99 s 14.01 s [-0.7%; +0.4%] (no difference)
startup:insecure-bank:tracing:Agent 12.98 s 13.07 s [-1.4%; +0.0%] (no difference)
startup:petclinic:appsec:Agent 17.14 s 17.65 s [-7.2%; +1.4%] (no difference)
startup:petclinic:iast:Agent 17.39 s 17.50 s [-1.3%; +0.1%] (no difference)
startup:petclinic:profiling:Agent 17.36 s 17.39 s [-1.4%; +1.2%] (no difference)
startup:petclinic:sca:Agent 17.15 s 17.62 s [-8.1%; +2.7%] (unstable)
startup:petclinic:tracing:Agent 16.65 s 16.74 s [-1.4%; +0.4%] (no difference)

Commit: 6ca119b9 · 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.

@amarziali
amarziali added this pull request to the merge queue Oct 8, 2026
@dd-octo-sts

dd-octo-sts Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-10-08 10:40:08 UTC ℹ️ Start processing command /merge


2026-10-08 10:40:12 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 1h (p90).


2026-10-08 12:03:01 UTC ❌ MergeQueue: The build pipeline failed for this merge request

Build pipeline has failing jobs for d78cc03:

⚠️ Do NOT retry failed jobs directly (why?).

What to do next?

  • Investigate the failures and when ready, re-add your pull request to the queue!
  • If your PR checks are green, try to rebase/merge. It might be because the CI run is a bit old.
  • Any question, go check the FAQ.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 8, 2026
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 023d78a into master Oct 8, 2026
613 of 617 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the andrea.marziali/fix-virtual-thread-startup-deadlock branch October 8, 2026 13:33
@github-actions github-actions Bot added this to the 1.68.0 milestone Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

inst: java Core Java language instrumentation tag: concurrency Virtual Threads, Coroutines, Async, RX, Executors type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants