Skip to content

Commit b83766e

Browse files
committedJul 5, 2024
8335632: jdk/jfr/api/consumer/streaming/TestJVMExit.java failed with "Process [...] is no longer alive"
Reviewed-by: mgronlun
1 parent 7efe160 commit b83766e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
 

‎test/jdk/jdk/jfr/api/consumer/streaming/TestJVMExit.java

+17
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,29 @@
3434
* @requires vm.hasJFR
3535
* @library /test/lib /test/jdk
3636
* @modules jdk.jfr jdk.attach java.base/jdk.internal.misc
37+
* @build jdk.jfr.api.consumer.streaming.TestProcess
3738
*
3839
* @run main/othervm -Dsun.tools.attach.attachTimeout=100000 jdk.jfr.api.consumer.streaming.TestJVMExit
3940
*/
4041
public class TestJVMExit {
4142

4243
public static void main(String... args) throws Exception {
44+
while (true) {
45+
try {
46+
testExit();
47+
return;
48+
} catch (RuntimeException e) {
49+
String message = String.valueOf(e.getMessage());
50+
// If the test application crashes during startup, retry.
51+
if (!message.contains("is no longer alive")) {
52+
throw e;
53+
}
54+
System.out.println("Application not alive when trying to get repository. Retrying.");
55+
}
56+
}
57+
}
58+
59+
private static void testExit() throws Exception {
4360
try (TestProcess process = new TestProcess("exit-application")) {
4461
AtomicInteger eventCounter = new AtomicInteger();
4562
try (EventStream es = EventStream.openRepository(process.getRepository())) {

0 commit comments

Comments
 (0)
Please sign in to comment.