Skip to content

Commit 12f8df7

Browse files
authored
Merge pull request #20313 from babsingh/v0.48.0-release
(0.48) Return NULL from getStackTraceForThread for unsteady virtual threads
2 parents 4bb34eb + bc274dd commit 12f8df7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

runtime/jcl/common/getstacktrace.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,16 @@ getStackTraceForThread(J9VMThread *currentThread, J9VMThread *targetThread, UDAT
8080
*/
8181
walkState.skipCount = 0;
8282
rc = vmfns->walkContinuationStackFrames(currentThread, targetThread->currentContinuation, threadObject, &walkState);
83-
} else if (isVirtual && (threadObject != targetThread->threadObject)) {
83+
} else if (isVirtual
84+
&& ((threadObject != targetThread->threadObject)
85+
|| (-1 == J9OBJECT_I64_LOAD(currentThread, threadObject, vm->virtualThreadInspectorCountOffset)))
86+
) {
8487
/* If the virtual thread object doesn't match the current thread object, it must have unmounted
8588
* from this carrier thread, return NULL and the JCL code will handle the retry.
89+
*
90+
* If inspectorCount is -1, then the virtual thread is in an unsteady state (mounting or unmounting).
91+
* In such cases, NULL should be returned and the JCL code should retry in order to avoid unexpected
92+
* behavior.
8693
*/
8794
vmfns->resumeThreadForInspection(currentThread, targetThread);
8895
goto done;

0 commit comments

Comments
 (0)