From 891765ee5eb1436663b8eb3d8e95467496ead540 Mon Sep 17 00:00:00 2001 From: Patricio Chilano Mateo Date: Tue, 11 Sep 2018 13:34:13 -0400 Subject: [PATCH] 8210300: runtime/MemberName/MemberNameLeak.java fails with RuntimeException Added flag -XX:+UnlockDiagnosticVMOptions to tests failing in product builds Reviewed-by: dcubed, dholmes --- .../Dictionary/CleanProtectionDomain.java | 16 ++++++++++++---- .../runtime/MemberName/MemberNameLeak.java | 17 ++++++++++++----- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java b/test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java index a136399b18b..3b559d9bc64 100644 --- a/test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java +++ b/test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java @@ -45,6 +45,7 @@ public class CleanProtectionDomain { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-Xlog:protectiondomain+table=debug", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", + "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", "-Xbootclasspath/a:.", Test.class.getName()); @@ -70,13 +71,20 @@ public class CleanProtectionDomain { test(); - System.gc(); // Wait until ServiceThread cleans ProtectionDomain table. // When the TestClassLoader is unloaded by GC, at least one // ProtectionDomainCacheEntry will be eligible for removal. - do { - removedCount = wb.protectionDomainRemovedCount(); - } while (removedCountOrig == removedCount); + int cnt = 0; + while (true) { + if (cnt++ % 30 == 0) { + System.gc(); + } + removedCount = wb.resolvedMethodRemovedCount(); + if (removedCountOrig != removedCount) { + break; + } + Thread.sleep(100); + } } private static class TestClassLoader extends ClassLoader { diff --git a/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java b/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java index 64890cf77b9..47456cfee6c 100644 --- a/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java +++ b/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java @@ -56,19 +56,26 @@ public class MemberNameLeak { mh.invokeExact(leak); } - System.gc(); // make mh unused - // Wait until ServiceThread cleans ResolvedMethod table - do { + int cnt = 0; + while (true) { + if (cnt++ % 30 == 0) { + System.gc(); // make mh unused + } removedCount = wb.resolvedMethodRemovedCount(); - } while (removedCountOrig == removedCount); + if (removedCountOrig != removedCount) { + break; + } + Thread.sleep(100); + } } } public static void test(String gc) throws Throwable { - // Run this Leak class with logging + // Run this Leak class with logging ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-Xlog:membername+table=trace", + "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", "-Xbootclasspath/a:.", gc, Leak.class.getName());