Skip to content

Collect thread dumps before heap dumps and start earlier - #12619

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
masterfrom
alexeyk/collect-test-dumps-earlier
Sep 23, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
masterfrom
alexeyk/collect-test-dumps-earlier

Conversation

@AlexeyKuznetsov-DD

Copy link
Copy Markdown
Contributor

What Does This Do

Start hung-test dump collection 180 seconds before the task timeout instead of 60 seconds. Collect thread dumps for all discovered workers and child processes, followed by the all-JVM thread dump, before starting any heap dumps.

Motivation

Heap-first collection could consume the remaining timeout window before reaching the thread-dump command. Gradle could then terminate the test worker while the collector was still working, leaving no usable thread dump. Collecting stacks first preserves the lightweight diagnostics before expensive heap collection, and starting earlier leaves more time for both.

Additional Notes

Follow-up to #12607, which added command timing and failure diagnostics. Those diagnostics exposed the collection-order problem; that PR did not introduce the heap-first ordering.

In an observed failure, the first worker's heap dump took about 17.5 seconds. The next worker's heap dump took 71.3 seconds, crossing the test task's 20-minute timeout. Its subsequent thread-dump request failed with:

java.io.IOException: Premature EOF
    at sun.tools.attach.HotSpotVirtualMachine.readInt(HotSpotVirtualMachine.java:292)
    at sun.tools.attach.LinuxVirtualMachine.execute(LinuxVirtualMachine.java:200)
    at sun.tools.attach.HotSpotVirtualMachine.executeCommand(HotSpotVirtualMachine.java:261)

The sequence explains the missing thread dump: the request was delayed behind heap collection until task timeout and worker teardown. The triggering task's directory can contain dumps from other active workers, so collecting every worker's stack before any heap dump matters.

Validation: 5 integration tests passed, including the default three-minute offset, thread-before-heap ordering, actual dump creation, directory failure reporting, and heap-command failure reporting.

./gradlew :buildSrc:test -PrunBuildSrcTests --tests datadog.gradle.plugin.dump.DumpHangedTestIntegrationTest

Task timeouts remain enforced. This improves diagnostic collection; it does not address the underlying test slowdown or guarantee that all heap dumps finish before termination.

Contributor Checklist

@AlexeyKuznetsov-DD AlexeyKuznetsov-DD added type: bug fix Bug fix comp: testing Testing tag: no release notes Changes to exclude from release notes tag: diagnostics Diagnostics related changes tag: ai generated Largely based on code generated by an AI or LLM labels Sep 23, 2026
@AlexeyKuznetsov-DD AlexeyKuznetsov-DD self-assigned this Sep 23, 2026
@datadog-prod-us1-6

datadog-prod-us1-6 Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 59.12% (-0.00%)

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

@AlexeyKuznetsov-DD
AlexeyKuznetsov-DD marked this pull request as ready for review September 23, 2026 17:43
@AlexeyKuznetsov-DD
AlexeyKuznetsov-DD requested a review from a team as a code owner September 23, 2026 17:43
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 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-09-23T17:46:10.361094Z 0cab7a5 Draft marked ready
🔒 Security Review ✅ Completed 2026-09-23T17:49:04.240956Z 0cab7a5 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.

@dd-octo-sts

dd-octo-sts Bot commented Sep 23, 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.96 s 13.97 s [-0.9%; +0.7%] (no difference)
startup:insecure-bank:tracing:Agent 12.96 s 13.03 s [-1.5%; +0.4%] (no difference)
startup:petclinic:appsec:Agent 17.62 s 17.31 s [+0.8%; +2.7%] (maybe worse)
startup:petclinic:iast:Agent 17.49 s 17.03 s [-1.8%; +7.3%] (no difference)
startup:petclinic:profiling:Agent 17.44 s 17.30 s [-0.5%; +2.1%] (no difference)
startup:petclinic:sca:Agent 17.51 s 16.67 s [+0.8%; +9.4%] (maybe worse)
startup:petclinic:tracing:Agent 16.11 s 16.65 s [-7.3%; +0.9%] (no difference)

Commit: 0cab7a5a · 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.

@datadog-prod-us1-6 datadog-prod-us1-6 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.

Bits Code Review: PASS

More details

The collector saves all thread dumps before a heap dump can use the remaining timeout period. The static review found no concrete fault in the new collection order or start time.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 0cab7a5 · @DataDog review to ask questions

@AlexeyKuznetsov-DD

Copy link
Copy Markdown
Contributor Author

/merge -f --reason "Fix for build, tested in PR, no need to run MQ"

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-09-23 18:16:58 UTC ℹ️ Start processing command /merge -f --reason "Fix for build, tested in PR, no need to run MQ"


2026-09-23 18:17:02 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 0s (p90).


2026-09-23 18:17:12 UTC ℹ️ MergeQueue: This merge request was merged

Warning

This change was merged without running any pre merge CI checks

Reason: Fix for build, tested in PR, no need to run MQ

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 3974868 into master Sep 23, 2026
616 of 619 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the alexeyk/collect-test-dumps-earlier branch September 23, 2026 18:17
@github-actions github-actions Bot added this to the 1.67.0 milestone Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: testing Testing tag: ai generated Largely based on code generated by an AI or LLM tag: diagnostics Diagnostics related changes tag: no release notes Changes to exclude from release notes type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants