8373643: Test serviceability/jvmti/vthread/ThreadListStackTracesTest/ThreadListStackTracesTest.java still failing

Reviewed-by: lmesnik
This commit is contained in:
Serguei Spitsyn 2026-01-10 11:10:06 +00:00
parent 657d5f77f4
commit 12894a870a

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -45,8 +45,9 @@ abstract class TestTask implements Runnable {
}
public void ensureReadyAndWaiting(Thread vt, Thread.State expState, ReentrantLock rlock) {
sleep(50); // reliability: wait for a potential class loading to complete
// wait while the thread is not ready or thread state is unexpected
while (!threadReady || (vt.getState() != expState) || !rlock.hasQueuedThreads()) {
while (!threadReady || (vt.getState() != expState) || !rlock.hasQueuedThread(vt)) {
sleep(1);
}
}
@ -125,11 +126,12 @@ public class ThreadListStackTracesTest {
int jvmtiExpState = (expState == Thread.State.WAITING) ?
JVMTI_THREAD_STATE_WAITING :
JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER;
Thread.State state = vt.getState();
System.out.printf("State: expected: %s single: %x multi: %x\n",
vt.getState(), singleState, multiState);
System.out.printf("State: expected: %s, vt.getState(): %s, jvmtiExpState: %x single: %x multi: %x\n",
expState, state, jvmtiExpState, singleState, multiState);
if (vt.getState() != expState) {
if (state != expState) {
failed("Java thread state is wrong");
}
if ((singleState & jvmtiExpState) == 0) {