Skip to content

fix(profiler): mark skipped frozen virtual-thread callers as truncated - #877

Draft
kaahos wants to merge 1 commit into
mainfrom
paul.fournillon/fix-frozen-virtual-thread-truncation
Draft

kaahos wants to merge 1 commit into
mainfrom
paul.fournillon/fix-frozen-virtual-thread-truncation

Conversation

@kaahos

@kaahos kaahos commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?:

Mark VM-walked stacks as truncated when a continuation return barrier leaves older Java callers frozen in heap chunks. Set the flag before stopping at the synthetic continuation root (cstack=vm) or continuing onto carrier frames (cstack=vmx). Fully thawed continuations retain their existing completeness behavior.

Add a regression test that compares sampled stacks with the JVM's logical stack, exercises both walking modes, and checks platform-thread and fully thawed virtual-thread controls.

Motivation:

After a virtual thread unmounts and remounts, HotSpot can thaw only part of its stack. The profiler skips the remaining frozen callers but previously could serialize the resulting stack as complete. Carrier frames can still be visible while application callers are missing.

Additional Notes:

This change corrects the completeness flag; it does not reconstruct frozen callers. It adds no allocations or locks to the walker.

The existing VirtualThreadWallClockTest.samplesCarrierFramesFromCpuBoundVT(vmx) fails on both unmodified HEAD and this branch because of the separate continuation metadata issue addressed by #870. In a disposable Linux build with #870's two production fixes applied, both new frozen-caller cases fail before this change and pass afterward, and the existing carrier check passes. Those unrelated fixes are not included in this PR.

How to test the change?:

./.claude/commands/build-and-summarize spotlessApply :ddprof-test:testDebug \
  -Ptests=FrozenVirtualThreadStackTest -Pskip-gtest -PkeepJFRs --max-workers=2
  • The exact final regression test fails against the pre-fix native library and passes with the fix.
  • All five cases pass on macOS arm64 / JDK 25 and Linux arm64 glibc / JDK 21 and 27, with no skips or retries and the default 512 MB test-worker heap.
  • Native debug suite: 884 passed, 6 skipped, 0 failed.
  • Independent JDK RecordingFile checks confirm the serialized truncation flag, including samples that retain carrier frames while omitting frozen application callers.
  • Pre-commit spotlessApply and git diff --check pass. Linux x86, musl, ASan/TSan, and the complete Java integration suite were not run.

For Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a security review.
  • This PR doesn't touch any of that.
  • JIRA: PROF-16269

/** Ending at a fully thawed continuation is a complete logical stack in the ordinary VM mode. */
@TestTemplate
@ValueSource(strings = {"vm"})
public void keepsFullyThawedContinuationComplete(@CStack String cstack) throws Exception {
/** The same parked workload on a platform thread keeps its application callers on the stack. */
@TestTemplate
@ValueSource(strings = {"vm", "vmx"})
public void keepsPlatformCallersComplete(@CStack String cstack) throws Exception {
/** Missing logical callers must be marked truncated in both VM walking modes. */
@TestTemplate
@ValueSource(strings = {"vm", "vmx"})
public void marksSkippedFrozenCallersTruncated(@CStack String cstack) throws Exception {
@dd-octo-sts

dd-octo-sts Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

CI Test Results

Run: #39329770068 | Commit: e3b2ed5 | Duration: 21m 56s (longest job)

❌ 3 of 32 test jobs failed

Status Overview

JDK glibc-aarch64/debug glibc-amd64/debug musl-aarch64/debug musl-amd64/debug
8 - ✅ - -
8-ibm - ✅ - -
8-j9 ✅ ❌ - -
8-librca - - ✅ ✅
8-orcl - ✅ - -
11 - ✅ - -
11-j9 ✅ ✅ - -
11-librca - - ✅ ✅
17 ✅ ✅ - -
17-graal ✅ ✅ - -
17-j9 ✅ ✅ - -
17-librca - - ✅ ✅
21 ✅ ❌ - -
21-graal ✅ ❌ - -
21-librca - - ✅ ✅
25 ✅ ✅ - -
25-graal ✅ ✅ - -
25-librca - - ✅ ✅

Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled

❌ Failing tests

Test Cells Message
VirtualThreadWallClockTest.cstack_vmx glibc-21-debug-amd64, glibc-21-graal-debug-amd64 org.opentest4j.AssertionFailedError: No sample showed carrier-thread frames (ForkJoinWorkerThread) — continuation unwind

Retried 2 of 32 cells.

Failed Jobs

Summary: Total: 32 | Passed: 29 | Failed: 3


Updated: 2026-10-19 22:09:22 UTC

@dd-octo-sts

dd-octo-sts Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

✅ All 40 integration tests passed

📊 Dashboard · 👷 Pipeline · 📦 e3bf2d37

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant