Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.
/ lanai Public archive

Commit 098b48b

Browse files
author
Mikhailo Seledtsov
committedMar 26, 2020
8240634: event/runtime/TestMetaspaceAllocationFailure.java times out
Limit number of iterations Reviewed-by: egahlin, stuefe
1 parent 54e2c6f commit 098b48b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed
 

‎test/jdk/jdk/jfr/event/runtime/TestMetaspaceAllocationFailure.java

+12-4
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@
2929
* @modules java.base/jdk.internal.misc java.compiler
3030
* @run main/othervm -Xmx1G -XX:MaxMetaspaceSize=200M
3131
* -XX:StartFlightRecording -Xshare:off
32+
* -Xlog:gc+metaspace*=debug
3233
* jdk.jfr.event.runtime.TestMetaspaceAllocationFailure
33-
* @run main/othervm -Xmx1G -XX:CompressedClassSpaceSize=200M
34+
* @run main/othervm -Xmx1G -XX:CompressedClassSpaceSize=10M
3435
* -XX:StartFlightRecording -Xshare:off
36+
* -Xlog:gc+metaspace*=debug
3537
* jdk.jfr.event.runtime.TestMetaspaceAllocationFailure
3638
*/
3739
package jdk.jfr.event.runtime;
@@ -40,21 +42,27 @@
4042
import jdk.jfr.consumer.RecordingStream;
4143
import jdk.test.lib.classloader.GeneratingCompilingClassLoader;
4244
import jdk.test.lib.Asserts;
43-
45+
import jtreg.SkippedException;
4446

4547
public class TestMetaspaceAllocationFailure {
48+
private static final int MAX_ITERATIONS = 100;
49+
4650
public static void main(String... args) throws Exception {
4751
AtomicBoolean eventArrived = new AtomicBoolean(false);
52+
4853
try (RecordingStream r = new RecordingStream()) {
4954
r.onEvent("jdk.MetaspaceAllocationFailure", e -> eventArrived.set(true));
5055
r.startAsync();
5156

5257
try {
58+
int iteration = 0;
5359
while (!eventArrived.get()) {
5460
GeneratingCompilingClassLoader cl = new GeneratingCompilingClassLoader();
5561
cl.getGeneratedClasses(50, 20);
56-
Thread.sleep(100);
57-
System.out.println("Iteration");
62+
System.out.println("Iteration:" + iteration++);
63+
if (iteration > MAX_ITERATIONS) {
64+
throw new SkippedException("Exceeded MAX_ITERATIONS of " + MAX_ITERATIONS);
65+
}
5866
}
5967
System.gc();
6068
System.out.println("main(): Event arrived");

0 commit comments

Comments
 (0)