From bcbb3bcc92a607a758cf0615f4e505a4280dd4c8 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Mon, 3 Aug 2026 19:39:29 +0000 Subject: [PATCH] Make loop infinite instead of counted so we get a core file if it fails. --- .../dcmd/thread/PrintRawMonitorLockTest.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/hotspot/jtreg/serviceability/dcmd/thread/PrintRawMonitorLockTest.java b/test/hotspot/jtreg/serviceability/dcmd/thread/PrintRawMonitorLockTest.java index 54bdc7849f5..ac176470247 100644 --- a/test/hotspot/jtreg/serviceability/dcmd/thread/PrintRawMonitorLockTest.java +++ b/test/hotspot/jtreg/serviceability/dcmd/thread/PrintRawMonitorLockTest.java @@ -117,14 +117,13 @@ public class PrintRawMonitorLockTest { OutputAnalyzer output = executor.execute("Thread.print -l=true"); if (!output.getOutput().contains("Found 1 deadlock")) { - // Execute dcmd in a loop in case the threads haven't deadlocked yet. - // Fail after 100 iterations. That's all it should take unless something is wrong. - for (int i = 0; i < 100; i++) { + // Execute dcmd in a timed loop in case the threads haven't deadlocked yet. + while (true) { try { Thread.sleep(100); } catch (InterruptedException ie) { } - // try again, otherwise java thinks it's not initialized. + // try again, otherwise java thinks output is not initialized. output = executor.execute("Thread.print -l=true"); if (output.getOutput().contains("Found 1 deadlock")) { break;