Repository navigation
Liveness epoch/urgency fixes, deferred chain invalidation, and debug JNI test seams - #798
Conversation
Scan-Build Report
Bug Summary
Reports
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CI Test ResultsRun: #37957706969 | Commit:
Status Overview
Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled Summary: Total: 32 | Passed: 32 | Failed: 0 Updated: 2026-10-09 16:40:54 UTC |
e8f5ee5 to
93f2dbf
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
93f2dbf to
217a7ab
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 93f2dbf486
ℹ️ 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".
There was a problem hiding this comment.
Stopping a recording can omit all reference-chain events since the last dump. The lifecycle also keeps strong thread references and stale chain data across recording sessions.
🤖 Datadog Autotest · Commit 93f2dbf · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
217a7ab to
b5588b7
Compare
b5588b7 to
b09e78d
Compare
e99dbc2 to
61cfd3d
Compare
61cfd3d to
ac29386
Compare
This comment has been minimized.
This comment has been minimized.
5f7ef97 to
2fbc79b
Compare
rkennke
left a comment
There was a problem hiding this comment.
Thanks, the fixes in 33686e9 look good. The deferral now covers the callback eviction path, the drain hands off the queue with an O(1) swap, the pending buffers are reset at every boundary, resetSession() closes the stale-flags gap, and the new tests cover what I asked for. (And you're right about _table_size, it's int; my nit was wrong.)
A few things still need sorting before this can merge:
- Review tool output got committed.
address-responses.json,preflight-evaluations.json,preflight-feedback.json,reviews.jsonandthreads.jsonwere added at the repo root. Please drop them from the branch. - Spec docs. The commit also adds
docs/sphinx/specs/2026-10-09-deferred-chain-invalidation-correctness.md. I'm not sure we want spec docs in the repo at all: they describe a point-in-time plan, go stale as soon as the code moves on, and the reasoning belongs in the PR description or in the code comments. I'd leave this one out of the PR. There are already two in main (docs/sphinx/specs/2026-05-29-...and2026-10-05-...); we should decide separately whether to keep those. - Merge conflict with main in
ddprof-lib/src/main/cpp/profiler.h, so the PR can't be merged right now. - PR title/description still describe the lifecycle/JFR/vmEntry wiring that landed in #797 and the old
ObjectSamplerrollback. They should cover what this PR does now: the debug JNI seams, the liveness epoch/urgency/session fixes, and deferred chain invalidation. - CI on the new head was still running when I looked; I'll check again once it's done.
One small nit inline.
Introduces the ReferenceChainEvent/ReferenceChainAbandonedEvent payloads (event.h), their JFR metadata (jfrMetadata.*), and the FlightRecorder emission paths that serialize chain events into JFR recording buffers, including the constant-pool handling for per-hop edge labels. Emission is pull-style: profiler.cpp snapshots events and hands them to FlightRecorder; this layer does not depend on the tracker itself.
- ReferenceChainEvent carries one vector of ReferenceChainHop (klass id + retention-edge label) instead of two parallel vectors - Compress the sub-option floor/ceiling rationale and the provisional default constant comments to one concise statement each - Drop design-doc and Jira references from code comments; revert the unrelated LineNumberTable comment rewrite
- cleanup_table: account_epoch flag; track() overflow sweep skips epoch claim - admitForTracking: LIVENESS_URGENT_BOOST_ADMITS/BACKED_OFF counters - secondsToOOM: zero-denominator guard; ringThirdsStats -> ringWindowStats - JNI poll seam calls finishLoopIterationSerialized - gtests: DipThenRecover, OddLengthRisingWindow
…rences pause - heapReferenceCallback ran invalidateResolvedChain() inside the FollowReferences STW pause, taking _resolved_chains_lock, which drainPendingChainEvents() holds across its cache copy on the JFR dump thread. Evictions are now queued and applied on the BFS thread outside any walk. - PriorityExpandSet::insert() had no occupancy bound and could spin forever on a full table; it now returns false.
… seam - referenceChainsPesTests.inc: PriorityExpandSet round-trip, rebuildFrom, full-table self-termination; ClassTagAllocator negative-tag minting - referenceChainsTestAccessors.h: cacheChain() passes source_tag and source_tag_val through unchanged - referenceChainsOomTests.inc: setCanaryBackoffForTest() takes ns
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
33686e9 to
6c84483
Compare
|
@rkennke I think I addressed all. I am planning to merge shortly if I don't hear any objections |
kaahos
left a comment
There was a problem hiding this comment.
this looks good to me; thanks for the changes!
What does this PR do?:
Fixes and debug tooling for the reference-chain engine and the liveness tracker. The lifecycle/JFR/vmEntry wiring this PR first described landed in main via #797 and is not in this diff.
javaApi.cppadds the...ForTestnatives declared inJavaProfiler.java: pending-expand inspection, pass/gate predicates, tracker internals. Debug builds only. Release builds export no-op stubs, so the calls do not throwUnsatisfiedLinkError._resolved_chains_lockinside the FollowReferences pause. All callback paths defer: walk admission and auto-mark. The pending queue and its overflow flag reset at every recording and search boundary.cleanup_table()takes anaccount_epochflag. The overflow sweep intrack()no longer claims the GC epoch the background sweep needs. Entries store their admission epoch and age only for GCs they survived.ObjectSampler::start()finishesLivenessTracker::start()before it enablesSAMPLED_OBJECT_ALLOCor publishes_active. New countersLIVENESS_URGENT_BOOST_ADMITS/LIVENESS_URGENT_BOOST_BACKED_OFF.secondsToOOM()no longer divides by zero.Motivation:
Review feedback on the reference-chain work. An overflow sweep could empty the chain cache before a dump. Urgency admissions raced table cleanup. Epoch aging undercounted entries. The JNI seams test engine state deterministically.
Additional Notes:
PriorityExpandSet::insert()returns false on a full table instead of probing forever.contains()keeps its unbounded probe; the set stays under half capacity. See the inline thread onreferenceChains.h.ProfiledThreadTLS on entry, like the other JNI entry points.How to test the change?:
:ddprof-lib:gtestDebug/:ddprof-lib:gtestRelease— referenceChains and liveness suites, incl. new tests for defer/drain, thePriorityExpandSetfull-table case, andaccount_epochaging.testDebug/testRelease.For Datadog employees:
credentials of any kind, I've requested a security review (run the
dd:platform-security-reviewskill, or file a request via the PSEC review form).
bewairealso runs automatically on every PR.