changeset 12192:7e0181d2ca46

8155570: serviceability/tmtools/jstat/GcTest02.java fails with parallel GC Reviewed-by: jwilhelm
author lmesnik
date Wed, 19 Oct 2016 10:10:51 +0300
parents 817bb013257f
children 99096bf79f31
files test/serviceability/tmtools/jstat/GcTest02.java test/serviceability/tmtools/jstat/utils/GcProvokerImpl.java
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/test/serviceability/tmtools/jstat/GcTest02.java	Wed Oct 19 12:10:43 2016 +0200
+++ b/test/serviceability/tmtools/jstat/GcTest02.java	Wed Oct 19 10:10:51 2016 +0300
@@ -31,7 +31,6 @@
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @library ../share
- * @ignore 8155570
  * @run main/othervm -XX:+UsePerfData -Xmx128M -XX:MaxMetaspaceSize=128M GcTest02
  */
 
--- a/test/serviceability/tmtools/jstat/utils/GcProvokerImpl.java	Wed Oct 19 12:10:43 2016 +0200
+++ b/test/serviceability/tmtools/jstat/utils/GcProvokerImpl.java	Wed Oct 19 10:10:51 2016 +0300
@@ -50,7 +50,7 @@
                 used += memoryChunk;
             } catch (OutOfMemoryError e) {
                 list = null;
-                throw new RuntimeException("Unexpected OOME while eating " + targetUsage + " of heap memory.");
+                throw new RuntimeException("Unexpected OOME '" + e.getMessage() + "' while eating " + targetUsage + " of heap memory.");
             }
         }
         return list;
@@ -73,8 +73,10 @@
 
     @Override
     public void eatMetaspaceAndHeap(float targetMemoryUsagePercent) {
+        // Metaspace should be filled before Java Heap to prevent unexpected OOME
+        // in the Java Heap while filling Metaspace
+        eatenMetaspace = eatMetaspace(targetMemoryUsagePercent);
         eatenMemory = eatHeapMemory(targetMemoryUsagePercent);
-        eatenMetaspace = eatMetaspace(targetMemoryUsagePercent);
     }
 
     private static List<Object> eatMetaspace(float targetUsage) {
@@ -97,7 +99,7 @@
                 list.add(gp.create(0));
             } catch (OutOfMemoryError oome) {
                 list = null;
-                throw new RuntimeException("Unexpected OOME while eating " + targetUsage + " of Metaspace.");
+                throw new RuntimeException("Unexpected OOME '" + oome.getMessage() + "' while eating " + targetUsage + " of Metaspace.");
             }
             MemoryUsage memoryUsage = metaspacePool.getUsage();
             currentUsage = (((float) memoryUsage.getUsed()) / memoryUsage.getMax());