8210300: runtime/MemberName/MemberNameLeak.java fails with RuntimeException
Summary: Added flag -XX:+UnlockDiagnosticVMOptions to tests failing in product builds
Reviewed-by: dcubed, dholmes
--- a/test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java Tue Sep 11 10:12:50 2018 -0700
+++ b/test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java Tue Sep 11 13:34:13 2018 -0400
@@ -45,6 +45,7 @@
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 @@
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 {
--- a/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java Tue Sep 11 10:12:50 2018 -0700
+++ b/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java Tue Sep 11 13:34:13 2018 -0400
@@ -56,19 +56,26 @@
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());