Skip to content

Commit 4047efb

Browse files
committed
8330022: Failure test/hotspot/jtreg/vmTestbase/nsk/sysdict/share/BTreeTest.java: Could not initialize class java.util.concurrent.ThreadLocalRandom
Backport-of: 4977588d5e3424282f40209590737a487747095d
1 parent 2a9d909 commit 4047efb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/GarbageUtils.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -245,6 +245,12 @@ public static int eatMemory(ExecutionController stresser, GarbageProducer gp, lo
245245
}
246246
}
247247

248+
private static Throwable ultimateCause(Throwable t) {
249+
while (t.getCause() != null) {
250+
t = t.getCause();
251+
}
252+
return t;
253+
}
248254

249255
public static int eatMemory(ExecutionController stresser, GarbageProducer gp, long initialFactor, long minMemoryChunk, long factor, OOM_TYPE type) {
250256
try {
@@ -253,6 +259,9 @@ public static int eatMemory(ExecutionController stresser, GarbageProducer gp, lo
253259
} catch (OutOfMemoryError e) {
254260
return numberOfOOMEs++;
255261
} catch (Throwable t) {
262+
if (ultimateCause(t) instanceof OutOfMemoryError) {
263+
return numberOfOOMEs++;
264+
}
256265
throw new RuntimeException(t);
257266
}
258267
}

0 commit comments

Comments
 (0)