Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
8240634: event/runtime/TestMetaspaceAllocationFailure.java times out
Limit number of iterations
Reviewed-by: egahlin, stuefe
- Loading branch information
|
@@ -29,9 +29,11 @@ |
|
|
* @modules java.base/jdk.internal.misc java.compiler |
|
|
* @run main/othervm -Xmx1G -XX:MaxMetaspaceSize=200M |
|
|
* -XX:StartFlightRecording -Xshare:off |
|
|
* -Xlog:gc+metaspace*=debug |
|
|
* jdk.jfr.event.runtime.TestMetaspaceAllocationFailure |
|
|
* @run main/othervm -Xmx1G -XX:CompressedClassSpaceSize=200M |
|
|
* @run main/othervm -Xmx1G -XX:CompressedClassSpaceSize=10M |
|
|
* -XX:StartFlightRecording -Xshare:off |
|
|
* -Xlog:gc+metaspace*=debug |
|
|
* jdk.jfr.event.runtime.TestMetaspaceAllocationFailure |
|
|
*/ |
|
|
package jdk.jfr.event.runtime; |
|
@@ -40,21 +42,27 @@ |
|
|
import jdk.jfr.consumer.RecordingStream; |
|
|
import jdk.test.lib.classloader.GeneratingCompilingClassLoader; |
|
|
import jdk.test.lib.Asserts; |
|
|
|
|
|
import jtreg.SkippedException; |
|
|
|
|
|
public class TestMetaspaceAllocationFailure { |
|
|
private static final int MAX_ITERATIONS = 100; |
|
|
|
|
|
public static void main(String... args) throws Exception { |
|
|
AtomicBoolean eventArrived = new AtomicBoolean(false); |
|
|
|
|
|
try (RecordingStream r = new RecordingStream()) { |
|
|
r.onEvent("jdk.MetaspaceAllocationFailure", e -> eventArrived.set(true)); |
|
|
r.startAsync(); |
|
|
|
|
|
try { |
|
|
int iteration = 0; |
|
|
while (!eventArrived.get()) { |
|
|
GeneratingCompilingClassLoader cl = new GeneratingCompilingClassLoader(); |
|
|
cl.getGeneratedClasses(50, 20); |
|
|
Thread.sleep(100); |
|
|
System.out.println("Iteration"); |
|
|
System.out.println("Iteration:" + iteration++); |
|
|
if (iteration > MAX_ITERATIONS) { |
|
|
throw new SkippedException("Exceeded MAX_ITERATIONS of " + MAX_ITERATIONS); |
|
|
} |
|
|
} |
|
|
System.gc(); |
|
|
System.out.println("main(): Event arrived"); |
|
|