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

Serguei Spitsyn sspitsyn at openjdk.org
Sat Jul 2 19:39:20 UTC 2022


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.

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

Commit messages:
 - 8289619: JVMTI SelfSuspendDisablerTest.java failed with RuntimeException: Test FAILED: Unexpected thread state

Changes: https://git.openjdk.org/jdk19/pull/105/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk19&pr=105&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8289619
  Stats: 2 lines in 1 file changed: 0 ins; 2 del; 0 mod
  Patch: https://git.openjdk.org/jdk19/pull/105.diff
  Fetch: git fetch https://git.openjdk.org/jdk19 pull/105/head:pull/105

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


More information about the serviceability-dev mailing list