# HG changeset patch # User lmesnik # Date 1476861051 -10800 # Node ID 390db590f10394bec3674d75b4edd608e5122ad9 # Parent 3755a8d3b5145032ee97ed3cbf3695ba9ce31375 8155570: serviceability/tmtools/jstat/GcTest02.java fails with parallel GC Reviewed-by: jwilhelm diff -r 3755a8d3b514 -r 390db590f103 hotspot/test/serviceability/tmtools/jstat/GcTest02.java --- a/hotspot/test/serviceability/tmtools/jstat/GcTest02.java Wed Oct 19 12:10:43 2016 +0200 +++ b/hotspot/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 */ diff -r 3755a8d3b514 -r 390db590f103 hotspot/test/serviceability/tmtools/jstat/utils/GcProvokerImpl.java --- a/hotspot/test/serviceability/tmtools/jstat/utils/GcProvokerImpl.java Wed Oct 19 12:10:43 2016 +0200 +++ b/hotspot/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 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());