RFR: 8254799: runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryError.java fails with release VMs
Yumin Qi
minqi at openjdk.java.net
Thu Oct 15 02:56:14 UTC 2020
On Thu, 15 Oct 2020 02:03:19 GMT, Jie Fu <jiefu at openjdk.org> wrote:
>> I like @dholmes-ora 's solution and will update the PR soon.
>> Thanks.
>
> Unfortunately, the following fix doesn't work.
> Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "",
> It seems that ProcessTools.createJavaProcessBuilder doesn't allow empty string as an arg.
>
> Would you mind something like:
> Platform.isDebugBuild() ? "-XX:-VerifyDependencies" : "-XX:MaxMetaspaceSize=16m",
> If you don't like it, I still prefer -XX:+IgnoreUnrecognizedVMOptions.
> I've grepped under jdk/test finding that there are about 700+ tests using -XX:+IgnoreUnrecognizedVMOptions.
> I didn't get the point why -XX:+IgnoreUnrecognizedVMOptions should be avoided for this case.
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?
-------------
PR: https://git.openjdk.java.net/jdk/pull/673
More information about the hotspot-runtime-dev
mailing list