Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7afa916

Browse files
babsinghrmnattas
authored andcommittedOct 18, 2024
Return NULL from getStackTraceForThread for unsteady virtual threads
If inspectorCount is -1, then the virtual thread is in an unsteady state (mounting or unmounting). In such cases, NULL should be returned and the JCL code should retry in order to avoid unexpected behavior. Related: eclipse-openj9#18910 Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
1 parent 77a2b0a commit 7afa916

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)
Please sign in to comment.