8226462: [TESTBUG] runtime/appcds/sharedStrings/SysDictCrash.java failed with Cannot dump shared archive
authorccheung
Tue, 25 Jun 2019 09:41:03 -0700
changeset 55501 c9590e526d19
parent 55500 80abfee2afaf
child 55502 bdaec4628ea9
8226462: [TESTBUG] runtime/appcds/sharedStrings/SysDictCrash.java failed with Cannot dump shared archive Summary: Add a CDS log statement in arguments.cpp. The test catches RuntimeException duing dumping and checks if the log statement is in the stdout. Reviewed-by: iklam, dholmes
src/hotspot/share/runtime/arguments.cpp
test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java
--- a/src/hotspot/share/runtime/arguments.cpp	Tue Jun 25 16:34:08 2019 +0100
+++ b/src/hotspot/share/runtime/arguments.cpp	Tue Jun 25 09:41:03 2019 -0700
@@ -1815,6 +1815,10 @@
       // was not specified.
       if (reasonable_max > max_coop_heap) {
         if (FLAG_IS_ERGO(UseCompressedOops) && override_coop_limit) {
+          log_info(cds)("UseCompressedOops and UseCompressedClassPointers have been disabled due to"
+            " max heap " SIZE_FORMAT " > compressed oop heap " SIZE_FORMAT ". "
+            "Please check the setting of MaxRAMPercentage %5.2f."
+            ,(size_t)reasonable_max, (size_t)max_coop_heap, MaxRAMPercentage);
           FLAG_SET_ERGO(UseCompressedOops, false);
           FLAG_SET_ERGO(UseCompressedClassPointers, false);
         } else {
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java	Tue Jun 25 16:34:08 2019 +0100
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java	Tue Jun 25 09:41:03 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,22 @@
             "-Xshare:dump",
             "-showversion", "-Xlog:cds,cds+hashtables"));
 
-        TestCommon.checkDump(TestCommon.executeAndLog(dumpPb, "dump"));
+        boolean continueTest = true;
+        OutputAnalyzer output = TestCommon.executeAndLog(dumpPb, "dump");
+        try {
+            TestCommon.checkDump(output);
+        } catch (java.lang.RuntimeException re) {
+            if (!output.getStdout().contains("UseCompressedOops and UseCompressedClassPointers have been disabled due to")) {
+                throw re;
+            } else {
+                System.out.println("Shared archive was not created due to UseCompressedOops and UseCompressedClassPointers have been disabled.");
+                continueTest = false;
+            }
+        }
+
+        if (!continueTest) {
+            return;
+        }
 
         ProcessBuilder runPb = ProcessTools.createJavaProcessBuilder(true,
           TestCommon.concat(vmOptionsPrefix,