Skip to content

(0.54) Adjust maxFrames in jvmtiInternalGetStackTrace for skipped frames #22393

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 8, 2025

Conversation

babsingh
Copy link
Contributor

@babsingh babsingh commented Aug 7, 2025

The JDWP frames command sets max_frame_count for JVMTI GetStackTrace
based on the value returned by JVMTI GetFrameCount, and expects the
number of frames filled by GetStackTrace to match that frame count.

For JDK 20 and later, when debugging virtual threads, the first stack
walk in jvmtiInternalGetStackTrace may filter out frames annotated
with JvmtiMountTransition. These frames represent mount and unmount
transitions for virtual threads and are not reported to the debugger.
As a result, the frame count returned by GetStackTrace can be less than
expected, causing JDWP to report a
com.sun.jdi.InternalException: Unexpected JDWP Error: 113.

This change increases maxFrames in the second stack walk by the number
of frames skipped in the first pass. This ensures that after skipping
mount transition frames, GetStackTrace can still return up to the
original max_frame_count to JDWP, preserving consistency between
GetFrameCount and GetStackTrace results and avoiding the above
InternalException.

Related: #22152

Backport of #22373

The JDWP frames command sets max_frame_count for JVMTI GetStackTrace
based on the value returned by JVMTI GetFrameCount, and expects the
number of frames filled by GetStackTrace to match that frame count.

For JDK 20 and later, when debugging virtual threads, the first stack
walk in jvmtiInternalGetStackTrace may filter out frames annotated
with JvmtiMountTransition. These frames represent mount and unmount
transitions for virtual threads and are not reported to the debugger.
As a result, the frame count returned by GetStackTrace can be less than
expected, causing JDWP to report a
com.sun.jdi.InternalException: Unexpected JDWP Error: 113.

This change increases maxFrames in the second stack walk by the number
of frames skipped in the first pass. This ensures that after skipping
mount transition frames, GetStackTrace can still return up to the
original max_frame_count to JDWP, preserving consistency between
GetFrameCount and GetStackTrace results and avoiding the above
InternalException.

Related: eclipse-openj9#22152

Signed-off-by: Babneet Singh <[email protected]>
@babsingh babsingh requested a review from tajila August 7, 2025 16:44
@babsingh
Copy link
Contributor Author

babsingh commented Aug 7, 2025

@pshipton I have included your commit from #22398 in this PR for backporting to 0.54.

@tajila tajila merged commit 25c9689 into eclipse-openj9:v0.54.0-release Aug 8, 2025
2 checks passed
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.

3 participants