From c46bed7292aad21b8cf9defcccac43c010a1f116 Mon Sep 17 00:00:00 2001 From: Serguei Spitsyn Date: Fri, 12 Dec 2025 04:03:33 +0000 Subject: [PATCH] 8371502: serviceability/jvmti/vthread/ThreadListStackTracesTest/ThreadListStackTracesTest.java failing Reviewed-by: lmesnik, amenkov --- .../ThreadListStackTracesTest.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadListStackTracesTest/ThreadListStackTracesTest.java b/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadListStackTracesTest/ThreadListStackTracesTest.java index 98695390ef7..079f65620d8 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadListStackTracesTest/ThreadListStackTracesTest.java +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadListStackTracesTest/ThreadListStackTracesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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 @@ -44,6 +44,13 @@ abstract class TestTask implements Runnable { } } + public void ensureReadyAndWaiting(Thread vt, Thread.State expState, ReentrantLock rlock) { + // wait while the thread is not ready or thread state is unexpected + while (!threadReady || (vt.getState() != expState) || !rlock.hasQueuedThreads()) { + sleep(1); + } + } + public void ensureReady(Thread vt, Thread.State expState) { // wait while the thread is not ready or thread state is unexpected while (!threadReady || (vt.getState() != expState)) { @@ -97,7 +104,7 @@ public class ThreadListStackTracesTest { String name = "ReentrantLockTestTask"; TestTask task = new ReentrantLockTestTask(); Thread vt = Thread.ofVirtual().name(name).start(task); - task.ensureReady(vt, expState); + task.ensureReadyAndWaiting(vt, expState, reentrantLock); checkStates(vt, expState); }