RFR: 8254799: runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryError.java fails with release VMs
Jie Fu
jiefu at openjdk.java.net
Thu Oct 15 03:18:16 UTC 2020
On Thu, 15 Oct 2020 02:58:46 GMT, Yumin Qi <minqi at openjdk.org> wrote:
>> Hi, Jie, David and Dan, I would like to reorg the code a little bit:
>>
>> `index a889ae11ed1..596ca348c30 100644
>> --- a/test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryError.java
>> +++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryError.java
>> @@ -31,10 +31,12 @@
>> import jdk.test.lib.Asserts;
>> import jdk.test.lib.classloader.GeneratingClassLoader;
>> import jdk.test.lib.hprof.HprofParser;
>> +import jdk.test.lib.Platform;
>> import jdk.test.lib.process.ProcessTools;
>> import jdk.test.lib.process.OutputAnalyzer;
>>
>> import java.io.File;
>> +import java.util.ArrayList;
>>
>> public class TestHeapDumpOnOutOfMemoryError {
>>
>> @@ -64,22 +66,29 @@ public class TestHeapDumpOnOutOfMemoryError {
>> }
>>
>> static void test(String type) throws Exception {
>> + ArrayList<String> args = new ArrayList();
>> +
>> String heapdumpFilename = type + ".hprof";
>> - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+HeapDumpOnOutOfMemoryError",
>> - "-XX:HeapDumpPath=" + heapdumpFilename,
>> - // Note: When trying to provoke a metaspace OOM we may generate a lot of classes. In debug VMs this
>> - // can cause considerable wait times since:
>> - // - Compiler Dependencies verification iterates the class tree
>> - // - Before exit, the CLDG is checked.
>> - // Both verifications show quadratic time or worse wrt to number of loaded classes. Therefore it
>> - // makes sense to switch one or both off and limit the metaspace size to something sensible.
>> - // Example numbers on a slow ppc64 machine:
>> - // MaxMetaspaceSize=64M - ~60-70K classes - ~20min runtime with all verifications
>> - // MaxMetaspaceSize=16M - ~12-15K classes - ~12sec runtime with all verifications
>> - // MaxMetaspaceSize=16M - ~12-15K classes - VerifyDependencies off - ~3seconds on ppc
>> - "-XX:MaxMetaspaceSize=16m",
>> - "-XX:-VerifyDependencies",
>> - TestHeapDumpOnOutOfMemoryError.class.getName(), type);
>> + // Note: When trying to provoke a metaspace OOM we may generate a lot of classes. In debug VMs this
>> + // can cause considerable wait times since:
>> + // - Compiler Dependencies verification iterates the class tree
>> + // - Before exit, the CLDG is checked.
>> + // Both verifications show quadratic time or worse wrt to number of loaded classes. Therefore it
>> + // makes sense to switch one or both off and limit the metaspace size to something sensible.
>> + // Example numbers on a slow ppc64 machine:
>> + // MaxMetaspaceSize=64M - ~60-70K classes - ~20min runtime with all verifications
>> + // MaxMetaspaceSize=16M - ~12-15K classes - ~12sec runtime with all verifications
>> + // MaxMetaspaceSize=16M - ~12-15K classes - VerifyDependencies off - ~3seconds on ppc
>> + args.add("-XX:+HeapDumpOnOutOfMemoryError");
>> + args.add("-XX:HeapDumpPath=" + heapdumpFilename);
>> + args.add("-XX:MaxMetaspaceSize=16m");
>> + if (Platform.isDebugBuild()) {
>> + args.add("-XX:-VerifyDependencies");
>> + }
>> + args.add(TestHeapDumpOnOutOfMemoryError.class.getName());
>> + args.add(type);
>> +
>> + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
>>
>> OutputAnalyzer output = new OutputAnalyzer(pb.start());
>> output.stdoutShouldNotBeEmpty();`
>>
>>
>>
>> What do you think?
>
> Aha, the diff looks ugly. Basically ProcessTools.createJavaProcessBuilder(List<?>) so you can manage the code there.
Hi @yminqi
To fix this bug, I prefer David's suggestion, which seems simple and elegant.
Thanks.
-------------
PR: https://git.openjdk.java.net/jdk/pull/673
More information about the hotspot-runtime-dev
mailing list