Skip to content

Close tracers built by debugger tests (quick fix) - #13040

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
masterfrom
dougqh/debugger-tests-close-tracers
Nov 19, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
masterfrom
dougqh/debugger-tests-close-tracers

Conversation

@dougqh

@dougqh dougqh commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What Does This Do

Debugger tests now close the CoreTracers they build.

Motivation

:dd-java-agent:agent-debugger:test runs out of its 512 MB heap on master.

  • What a heap dump showed: 46 PayloadDispatcherImpl instances retained 225 MB, 65% of the heap, about 5.2 MB each.
  • What holds them: live TraceProcessingWorker serializer threads.
  • Why: eight test classes call CoreTracer.builder().build(), which uses the default agent writer, and never close the tracer. The writer's thread stays alive and pins its msgpack buffer, created on the first trace written. ExceptionProbeInstrumentationTest builds one per test in @BeforeEach, and Add coordinated sampling for snapshot probes #12452 added CoordinatedSamplingTest with nine more call sites.

The fix:

  • Each test keeps a reference to the tracer it builds and closes it in teardown.
  • For CapturingTestBase subclasses, that's a shared field, closed in CapturingTestBase.after().
  • LogProbeTest builds several per test, so it closes them in a list @AfterEach.

The test task now completes: 950 tests, 15 skipped, no failures, no OOM.

Since then, #13096 replaced the writer's single 5 MiB array with chunked buffers, so a leaked writer now pins much less memory and the OOM may not reproduce on master. The leak itself remains (each unclosed tracer keeps its writer thread running across tests), so this is still worth having as test hygiene. Re-checked after syncing with master: 963 tests, 16 skipped, no failures.

Additional Notes

Test-only change.

🤖 Generated with Claude Code

Debugger tests built CoreTracers with the default agent writer and never
closed them. Each one kept a serializer thread alive, pinning that
writer's 5 MB payload buffer, so the test JVM accumulated them until
agent-debugger:test ran out of its 512 MB heap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dougqh dougqh added tag: no release notes Changes to exclude from release notes comp: debugger Dynamic Instrumentation tag: ai generated Largely based on code generated by an AI or LLM type: bug labels Oct 23, 2026
@datadog-official

datadog-official Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 75.43% (+14.62%)

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

@pr-commenter

pr-commenter Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Debugger benchmarks

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
ci_job_date 1795126742 1795127100
end_time 2026-11-19T22:20:32 2026-11-19T22:26:31
git_branch master dougqh/debugger-tests-close-tracers
git_commit_sha 62d4d1a 30b230b
start_time 2026-11-19T22:19:02 2026-11-19T22:25:01
See matching parameters
Baseline Candidate
ci_job_id 2279736846 2279736846
ci_pipeline_id 154981212 154981212
cpu_model Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz
git_commit_date 1795125915 1795125915

Summary

Found 5 performance improvements and 0 performance regressions! Performance is the same for 4 metrics, 6 unstable metrics.

scenario Δ mean agg_http_req_duration_min Δ mean agg_http_req_duration_p50 Δ mean agg_http_req_duration_p75 Δ mean agg_http_req_duration_p99 Δ mean throughput
scenario:loop better
[-1.854ms; -1.514ms] or [-19.041%; -15.544%]
better
[-1.887ms; -1.547ms] or [-19.190%; -15.724%]
better
[-1.880ms; -1.542ms] or [-19.052%; -15.623%]
better
[-1.846ms; -1.496ms] or [-18.541%; -15.028%]
better
[+16.548op/s; +21.795op/s] or [+16.217%; +21.359%]
See unchanged results
scenario Δ mean agg_http_req_duration_min Δ mean agg_http_req_duration_p50 Δ mean agg_http_req_duration_p75 Δ mean agg_http_req_duration_p99 Δ mean throughput
scenario:noprobe unstable
[-679.103µs; +226.997µs] or [-120.937%; +40.424%]
unstable
[-676.710µs; +229.141µs] or [-114.226%; +38.678%]
unstable
[-675.880µs; +230.855µs] or [-111.585%; +38.113%]
unstable
[-548.967µs; +350.333µs] or [-45.771%; +29.209%]
same
scenario:basic same same same unstable
[-81.181µs; +204.566µs] or [-7.922%; +19.963%]
unstable
[-114.733op/s; +114.733op/s] or [-5.163%; +5.163%]
Request duration reports for reports
gantt
    title reports - request duration [CI 0.99] : candidate=None, baseline=None
    dateFormat X
    axisFormat %s
section baseline
noprobe (592.434 µs) : -15, 1200
.   : milestone, 592,
basic (345.18 µs) : 341, 350
.   : milestone, 345,
loop (9.836 ms) : 9621, 10050
.   : milestone, 9836,
section candidate
noprobe (368.649 µs) : 336, 402
.   : milestone, 369,
basic (349.447 µs) : 344, 355
.   : milestone, 349,
loop (8.119 ms) : 8055, 8183
.   : milestone, 8119,
Loading
  • baseline results
Scenario Request median duration [CI 0.99]
noprobe 592.434 µs [-14.794 µs, 1.2 ms]
basic 345.18 µs [340.571 µs, 349.789 µs]
loop 9.836 ms [9.621 ms, 10.05 ms]
  • candidate results
Scenario Request median duration [CI 0.99]
noprobe 368.649 µs [335.62 µs, 401.678 µs]
basic 349.447 µs [343.624 µs, 355.269 µs]
loop 8.119 ms [8.055 ms, 8.183 ms]

@dd-octo-sts

dd-octo-sts Bot commented Oct 24, 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.95 s [-0.6%; +0.7%] (no difference)
startup:insecure-bank:tracing:Agent 12.93 s 12.90 s [-0.4%; +0.9%] (no difference)
startup:petclinic:appsec:Agent 17.27 s 17.07 s [+0.5%; +1.9%] (maybe worse)
startup:petclinic:iast:Agent 17.14 s 17.20 s [-1.2%; +0.6%] (no difference)
startup:petclinic:profiling:Agent 16.61 s 16.85 s [-2.7%; -0.2%] (maybe better)
startup:petclinic:sca:Agent 17.22 s 17.06 s [-0.1%; +1.9%] (no difference)
startup:petclinic:tracing:Agent 16.22 s 16.20 s [-0.6%; +0.9%] (no difference)

Commit: 30b230b8 · 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.

@dougqh
dougqh marked this pull request as ready for review November 19, 2026 22:09
@dougqh
dougqh requested review from a team as code owners November 19, 2026 22:09
@dougqh
dougqh requested review from jordan-wong and tylfin and removed request for a team November 19, 2026 22:09
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 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-11-19T22:12:39.529907Z 30b230b 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.

@tylfin tylfin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks for patching that

@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

Tracer ownership and teardown match the affected test lifecycles, including tests that create multiple tracers. The static review identified no actionable defects.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 30b230b

@dougqh

dougqh commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-11-19 22:32:29 UTC ℹ️ Start processing command /merge


2026-11-19 22:32:42 UTC ℹ️ MergeQueue: Pull request is not mergeable yet

It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.

  • Run /code blockers to see what is blocking it.
  • Run /remove to cancel it.

2026-11-19 22:54:22 UTC ℹ️ MergeQueue: merge request added to the queue

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


2026-11-19 23:42:09 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 17ad667 into master Nov 19, 2026
705 of 708 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the dougqh/debugger-tests-close-tracers branch November 19, 2026 23:42
@github-actions github-actions Bot added this to the 1.70.0 milestone Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: debugger Dynamic Instrumentation tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants