On Sat, 2 Jul 2022 19:16:19 GMT, Serguei Spitsyn <sspit...@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. This pull request has now been integrated. Changeset: c4dcce4b Author: Serguei Spitsyn <sspit...@openjdk.org> URL: https://git.openjdk.org/jdk19/commit/c4dcce4bca8808f8f733128f2e2b1dd48a28a322 Stats: 2 lines in 1 file changed: 0 ins; 2 del; 0 mod 8289619: JVMTI SelfSuspendDisablerTest.java failed with RuntimeException: Test FAILED: Unexpected thread state Reviewed-by: alanb, cjplummer ------------- PR: https://git.openjdk.org/jdk19/pull/105