diff --git a/runtime/jcl/common/getstacktrace.c b/runtime/jcl/common/getstacktrace.c index 19b098fb3e1..151eb95dd43 100644 --- a/runtime/jcl/common/getstacktrace.c +++ b/runtime/jcl/common/getstacktrace.c @@ -80,7 +80,10 @@ getStackTraceForThread(J9VMThread *currentThread, J9VMThread *targetThread, UDAT */ walkState.skipCount = 0; rc = vmfns->walkContinuationStackFrames(currentThread, targetThread->currentContinuation, threadObject, &walkState); - } else if (isVirtual && (threadObject != targetThread->threadObject)) { + } else if (isVirtual + && ((threadObject != targetThread->threadObject) + || (-1 == J9OBJECT_I64_LOAD(currentThread, threadObject, vm->virtualThreadInspectorCountOffset))) + ) { /* If the virtual thread object doesn't match the current thread object, it must have unmounted * from this carrier thread, return NULL and the JCL code will handle the retry. */