8347779: sun/tools/jhsdb/HeapDumpTestWithActiveProcess.java fails with Unable to deduce type of thread from address

Reviewed-by: cjplummer, kevinw
This commit is contained in:
Matthias Baesken 2025-01-30 08:23:04 +00:00
parent d985b31cbb
commit 04c24f18d5

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 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
@ -53,7 +53,8 @@ public class JShellHeapDumpTest {
static Process jShellProcess;
static boolean doSleep = true; // By default do a short sleep when app starts up
public static void launch(String expectedMessage, List<String> toolArgs)
// Returns false if the attempt should be retried.
public static boolean launch(String expectedMessage, List<String> toolArgs, boolean allowRetry)
throws IOException {
try {
@ -81,6 +82,10 @@ public class JShellHeapDumpTest {
System.out.println("###### End of all output which took " + elapsedTime + "ms");
output.shouldHaveExitValue(0);
} catch (Exception ex) {
if (allowRetry) {
System.out.println("Exception " + ex + " in 'launch' occured. Allow one retry.");
return false;
}
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {
if (jShellProcess.isAlive()) {
@ -91,12 +96,18 @@ public class JShellHeapDumpTest {
System.out.println("Jshell not alive");
}
}
return true;
}
public static void launch(String expectedMessage, String... toolArgs)
throws IOException {
launch(expectedMessage, Arrays.asList(toolArgs));
boolean res = launch(expectedMessage, Arrays.asList(toolArgs), true);
// Allow a retry for !doSleep, because the sleep allows the debuggee to stabilize,
// making it very unlikely that jmap will fail.
if (!res && !doSleep) {
launch(expectedMessage, Arrays.asList(toolArgs), false);
}
}
/* Returns false if the attempt should be retried. */