I was not able to reproduce this issue in thousands of mach5 runs on multiple platforms. However, the root cause seems to be pretty simple. A JvmtiVTMSTransitionDisabler needs to be added to make the JVM TI StopThread function to be VTMS (Virtual Thread Mount state) transition safe.
So the fix is a one-liner: diff --git a/src/hotspot/share/prims/jvmtiEnv.cpp b/src/hotspot/share/prims/jvmtiEnv.cpp index a9efe01c92e..f5e9176230a 100644 --- a/src/hotspot/share/prims/jvmtiEnv.cpp +++ b/src/hotspot/share/prims/jvmtiEnv.cpp @@ -1182,6 +1182,8 @@ JvmtiEnv::ResumeAllVirtualThreads(jint except_count, const jthread* except_list) jvmtiError JvmtiEnv::StopThread(jthread thread, jobject exception) { JavaThread* current_thread = JavaThread::current(); + + JvmtiVTMSTransitionDisabler disabler; ThreadsListHandle tlh(current_thread); JavaThread* java_thread = NULL; oop thread_oop = NULL; ------------- Commit messages: - 8293339: vm/jvmti/StopThread/stop001/stop00103 crashes with SIGSEGV in Continuation::is_continuation_mounted Changes: https://git.openjdk.org/jdk/pull/10235/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10235&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8293339 Stats: 2 lines in 1 file changed: 2 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/10235.diff Fetch: git fetch https://git.openjdk.org/jdk pull/10235/head:pull/10235 PR: https://git.openjdk.org/jdk/pull/10235