Repository navigation
Conversation
CI Test ResultsRun: #46003289062 | Commit:
Status Overview
Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled Summary: Total: 108 | Passed: 108 | Failed: 0 Updated: 2026-11-27 13:25:31 UTC |
Reliability & Chaos Results✅ All reliability & chaos checks passed Pipeline: https://gitlab.ddbuild.io/DataDog/java-profiler/-/pipelines/156789598 |
…nto paul.fournillon/fix-continuation-carrier-recovery
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. |
There was a problem hiding this comment.
The 128-word argument limit rejects legal high-arity compiled methods at continuation return barriers, causing break_cont_entry_fp and dropping carrier ancestry.
🤖 Bits Code Review · Commit d65cc18
Keep the walker truncation flag when a stack ends at a Java entry method. Exercise speculative continuation recovery and stack-pool header encoding with native regression tests, and rename the never-parked virtual-thread control.
Preserve SP-based carrier recovery with explicit continuation-boundary classification and truncation. Adapt the native walker fixtures to the required metadata, cover missing-metadata rejection, and retain vm/vmx coverage for never-parked virtual threads.
…nto paul.fournillon/fix-continuation-carrier-recovery
Handle enterSpecial prologue and epilogue phases using sampled register state. Recover frozen return-barrier entries with unknown stack arguments through a validated JavaThread offset discovered during initialization. Add native recovery regressions and checker controls. Keep confirmed idle-carrier native gaps outside the continuation budget while preserving the 99 percent threshold and strict continuation ancestry checks.
|
@DataDog review |
There was a problem hiding this comment.
The new high-arity test can fail CI on a known intermittent stack-walk failure that occurs before continuation recovery runs.
🤖 Bits Code Review · Commit 644a802
There was a problem hiding this comment.
If x64 HotSpot emits an enterSpecial epilogue the decoder does not recognize, a sample in the exception tail can use the full-frame layout after SP has moved and read carrier registers from the wrong stack slots.
🤖 Bits Code Review · Commit 644a802
# Conflicts: # doc/README.md
|
@DataDog review |
Memory overhead check: ✅ within budgetProfiler
✅ Not budgeted (too noisy on shared runners)
|
There was a problem hiding this comment.
An unrecognized x64 enterSpecial epilogue can make the unwinder use the full frame size after the exception path has restored SP, leading it to read carrier state from the wrong stack slots.
🤖 Bits Code Review · Commit 042b7bf
|
@DataDog review |
There was a problem hiding this comment.
More details
The PR adds phase-aware x64/ARM64 carrier recovery while preserving truthful truncation; this update requires a recognized normal x64 epilogue before accepting complete-frame layouts. No reportable findings remain open, but tests were not run and live exception sampling and high-arity reliability remain unverified.
🤖 Bits Code Review · Commit 609fbcb
There was a problem hiding this comment.
The x64 continuation decoder can read past the nmethod boundary if that boundary cuts through the entry prologue. Runtime reachability on a supported JVM remains unverified.
🤖 Bits Code Review · Commit 609fbcb
| if (entry[0] != 0x55 || entry[1] != 0x48 || | ||
| !((entry[2] == 0x8b && entry[3] == 0xec) || | ||
| (entry[2] == 0x89 && entry[3] == 0xe5)) || | ||
| entry[4] != 0x48 || entry[6] != 0xec) return -1; | ||
| unsigned int storage; | ||
| int allocated; | ||
| if (entry[5] == 0x83) { | ||
| storage = entry[7]; | ||
| allocated = 8; | ||
| } else if (entry[5] == 0x81) { |
There was a problem hiding this comment.
Bound x64 entry prologue reads to the nmethod
If an nmethod's reported end cuts off the x64 entry prologue, the decoder can read the missing bytes beyond the blob. If those bytes match the expected stack allocation, the signal-path walker can accept the incomplete prologue and use an unvalidated layout to recover carrier ancestry.
| if (entry[0] != 0x55 || entry[1] != 0x48 || | |
| !((entry[2] == 0x8b && entry[3] == 0xec) || | |
| (entry[2] == 0x89 && entry[3] == 0xe5)) || | |
| entry[4] != 0x48 || entry[6] != 0xec) return -1; | |
| unsigned int storage; | |
| int allocated; | |
| if (entry[5] == 0x83) { | |
| storage = entry[7]; | |
| allocated = 8; | |
| } else if (entry[5] == 0x81) { | |
| if (!nm->contains(entry + 7) || entry[0] != 0x55 || entry[1] != 0x48 || | |
| !((entry[2] == 0x8b && entry[3] == 0xec) || | |
| (entry[2] == 0x89 && entry[3] == 0xe5)) || | |
| entry[4] != 0x48 || entry[6] != 0xec) return -1; | |
| unsigned int storage; | |
| int allocated; | |
| if (entry[5] == 0x83) { | |
| storage = entry[7]; | |
| allocated = 8; | |
| } else if (entry[5] == 0x81 && nm->contains(entry + 10)) { |
React: 👍 useful · 👎 wrong · 😕 unclear · 👀 right, but not acting on it
What each reaction means
- 👍 Useful: correct, and you're fixing it or will.
- 👎 Wrong: the finding is incorrect, for example the bug can't happen or the code was misread.
- 😕 Unclear: you can't tell what it means or why it matters.
- 👀 Right, not acting: correct, but intended, out of scope for this PR, a known risk, or too minor.
🤖 Bits Code Review · Open Bits AI session
|
Review of Please change1. Revert both
|
| Location | Boundary | Missing case |
|---|---|---|
hotspotSupport.cpp, walkThroughContinuation |
saved_fp = words >= 2 |
two-word phase where the sampled FP differs from the saved slot (fixtures set them equal) |
hotspotSupport.cpp, walkThroughContinuation |
sampled_entry && truncated != nullptr |
sampled enterSpecial PC with a null truncated |
continuationEntryThreadOffset (x64) |
disp8 < 0x80 |
0x7f accepted, 0x80 rejected |
continuationEntryThreadOffset (x64) |
disp32 sign >= 0x80 |
top byte exactly 0x80 |
VMStructs::initContEntryThreadOffset |
8-byte alignment of the decoded offset | displacement 12 → -1 |
continuationEntryFrameWords (x64 and arm64) |
words > 256 |
exactly 256 words accepted |
VMNMethod::continuationEntryFP |
frame_size > 256 |
exactly 256 accepted |
Questions
- JDK coverage of the byte patterns. Which JDK versions and builds were the x64 and arm64 patterns checked against (
gen_continuation_entercleanup pairs,test esp/test spl, call shapes, PAC/BTI prefixes)? Was the reject path exercised on a JDK whose code does not match, for example a fastdebug build? - Remaining guesses. Please list the paths that still produce frames from a heuristic instead of validated metadata. I see the
contBoundaryEntryFpIsCurrentFp(kind) ? fp : 0fallback, the x64 undecoded return that follows the exported chain whennext_entry == sp, and the arm64 exported-chain branch without an SP check. HighArityVirtualThreadStackTestexclusion. The silent-stop flake predates this PR. Please file a PROF ticket for it and reference it in the exclusion, so the exclusion has an owner and can be removed.- CI. Did the new x64-only gtests run in the amd64 gtest cells for this head? The
integration-test-arm64-musl: [openj9, 11]failure ("No datadog.ExecutionSample events found") looks like the JFR validator issue that PROF-16618 ci: JFR conformance validator probes event types through the script engine #987 (PROF-16618) fixes, not this change.
…ith release ordering
What does this PR do?:
Extend continuation-boundary unwinding to recover carrier ancestry when preserved frame-pointer links are unavailable. Use validated entry layouts and argument counts to locate saved carrier registers, and retire consumed Java anchors after crossing a boundary.
Handle sampled compiled/interpreted entry phases, ARM64 exception exits and VM-leaf spills. On x64, recover recognized exception-exit phases and native resolver returns even after the continuation entry has been unlinked. Distinguish saved RBP from restored RBP and exception spills; use interrupted RDX only when the final return PC has left the stack. Resolver returns use reconstructed SP/RBP and the stacked PC, not unrelated sampled registers.
Motivation:
Fast thaw does not repair every frame-pointer link, and compiled carrier code can use FP as a general-purpose register. A complete-frame assumption also fails during exception cleanup, where SP and the sources of saved registers change. Phase-aware recovery prevents valid transitions from losing carrier ancestry while retaining bounds, alignment, entry identity and PC validation.
Additional Notes:
enterSpecialblob and adds no allocation or blocking synchronization to the signal path. It reads code bytes with inline loads, not libcmemcmp/memcpy, becausecheckFault()cannot recover a fault inside libc.enterSpecialkeeps the exportedContinuationEntryrecovery when the phase decoders reject the code. A return to the exact entry return PC skips the decoders. Another undecoded return uses the exported chain only when the next entry starts at SP, whereenterSpecialpublishes it; an unlinked entry still stops withbreak_cont_entry_fp.VMStructs::enterSpecialNMethod()publishes a lookup made after initialization (release store, acquire load), and each crossing resolves the PC's code blob once. The lateContinuationEntry::_return_pcvalue and symbol address are published the same way.VMNMethod::mayBeOsr()treats a missing_entry_bcioffset as possible OSR, so argument-based recovery is skipped instead of relying on anassert.HighArityVirtualThreadStackTest. About 1–5% of local runs contain a sample whose walk stops silently after 1–3 Java frames: a compiled frame's sender PC lands outside the CodeHeap, the FP-chain fallback cannot advance, and no error frame is emitted. The walk has not reached a continuation boundary, and it also happens on platform threads. The PR's merge basea5b5ca88eshows the same rate (table below), so this PR does not cause it. The test now excludes such a sample when it has no break marker, did not reach the boundary, ends at a compiled Java frame and is marked truncated (JFR marks a non-entry Java root truncated). Unflagged silent stops still fail its truncation check. A fault-recovered walk (break_not_walkable) is never excluded and fails the test. The silent stop is tracked in PROF-16769./code-reviewmedium on the full range, then on each fix range (two re-review rounds). Fixed: the x64 return-into-enterSpecialregression against main, the uncached lateenterSpeciallookup, and a test whose geometry could not reach the new path. Not changed: clearing the anchor on entry towalkThroughContinuationis the documented anchor-retirement invariant. The fixes for the human and Bits review comments (609fbcbf9..b6f381190) had/code-reviewmedium on the fix range and once more on its follow-up fixes; no Critical or High finding. Open Low items:continuationEntryExceptionLayouthas no test that accepts exactly 256 words.X64UndecodedReturnRejectsUnlinkedEntrydistinguishes a removed SP check only by the error string, and the leaf-placement comment does not fit its unlinked case.cont_entry ? parent() : contEntry()) now appears twice inwalkThroughContinuation; the sampled-entry exclusion of the fallback has no test.VM::ready()rerunsVMStructs::init()andresolveOffsets()when the Java API loads a library that an agent already started. Most fields are rewritten with unchanged values, but_code_heap_segment_shift(and_data_offsetbefore JDK 23) briefly hold a raw offset while samplers may read them. This predates the change;_cont_entry_return_pcand its address are now published with release stores.enterSpecialis now marked truncated in bothvmandvmxmodes: during a remount it can precede thaw while the callers are still frozen. This deliberately also flags exception-exit samples.enterSpecialdecoder applies the complete frame size only when a recognized normal exit follows the PC; with no recognized exit it rejects, so a missed epilogue cannot send an exception-section sample down the full-frame path.enterSpecialprologue decoders check that every prologue byte they read lies inside the nmethod, and the arm64 decoder also checks the PC and the entry.truncated, a misaligned (12-byte) return-barrier thread offset, and exactly 256 words incontinuationEntryFP, the arm64 and the x64 decoders._entry_bciand_num_stack_arg_slotsmoved to a new optional vmStructs list (DECLARE_OPTIONAL_TYPE_FIELD_DO) thatverify_offsets()skips, so debug builds no longer abort on a JVM that omits them.How to test the change?:
./.claude/commands/build-and-summarize :ddprof-lib:gtestDebug \ :ddprof-lib:gtestRelease_continuationWalk_ut JAVA_TEST_HOME=/path/to/jdk ./.claude/commands/build-and-summarize \ :ddprof-test:testDebug '-Ptests=*VirtualThread*Test' -Pskip-gtest -PkeepJFRsOn a supported Linux/glibc ASan configuration, also run:
The x64 exception-recovery change adds 17 production-walker regressions and changes two existing rejection expectations to require carrier recovery. They cover cleanup and register-restoration boundaries, exception spills, final RDX state, reconstructed resolver frames, null/parent metadata, near/far calls, actual JDK21 byte-test encoding and conservative rejection. Three more x64-only regressions cover undecoded returns into
enterSpecial(exact return PC, entry published at SP, unlinked entry), andLateEntryWrapperLookupIsPublishedchecks the late lookup.Validation for
9fe55290f(includesmainatb9c1dfea1)::ddprof-lib:gtestDebug: passed (1,662 tests, 0 failed), including the arm64 decoder bounds incontinuationEntryAarch64_ut.qualityChecksandspotlessCheck: passed.gtestDebug_continuationWalk_utandgtestDebug_continuationCarrierFrame_ut(podman, glibc, JDK 25, debug, emulated): passed.gtestDebug_continuationEntryX64_utpassed on6383ebde1; later commits do not change it or the x64 decoder.HighArityVirtualThreadStackTest(podman, glibc, JDK 25, debug): passed on6383ebde1withnotWalkable=0.For Datadog employees: