[jdk19] RFR: 8289619: JVMTI SelfSuspendDisablerTest.java failed with RuntimeException: Test FAILED: Unexpected thread state

Alan Bateman alanb at openjdk.org
Sat Jul 2 19:39:20 UTC 2022


On Sat, 2 Jul 2022 19:16:19 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:

> This regression was recently introduced with my update of this test.
> One of the newly added checks is not stable/correct:
> 
> 
>  71     public static void main(String argv[]) throws Exception {
>  72         Thread t1 = Thread.ofPlatform().factory().newThread(() -> {
>  73             testJvmtiThreadState(Thread.currentThread(), RUNNABLE);
>  74             selfSuspend();
>  75         });
>  76         Thread t2 = Thread.ofVirtual().factory().newThread(() -> {
>  77             testJvmtiThreadState(Thread.currentThread(), RUNNABLE);
>  78             while(!isSuspended(t1)) {
>  79               Thread.yield();
>  80             }
>  81             Thread.yield(); // provoke unmount
>  82 
>  83             testJvmtiThreadState(t1, SUSPENDED);
>  84 
>  85             resume(t1);
>  86 
>  87             testJvmtiThreadState(t1, RUNNABLE);  <== This line caused the test to fail!!
>  88 
>  89             suspendAllVirtualThreads();
>  90         });
> 
> The line 87 needs to be removed.
> There is a race here as the target platform thread can be already terminated.
> However, the check is expecting the target thread to be in runnable state.

Marked as reviewed by alanb (Reviewer).

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

PR: https://git.openjdk.org/jdk19/pull/105


More information about the serviceability-dev mailing list