On Sat, 10 Sep 2022 00:05:22 GMT, Serguei Spitsyn <sspit...@openjdk.org> wrote:

> 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;

Marked as reviewed by cjplummer (Reviewer).

-------------

PR: https://git.openjdk.org/jdk/pull/10235

Reply via email to