8289257: Some custom loader tests failed due to symbol refcount not decremented

Reviewed-by: iklam, coleenp
This commit is contained in:
Calvin Cheung 2022-07-01 16:11:17 +00:00
parent 09b4032f8b
commit c43bdf7165
2 changed files with 1 additions and 15 deletions

View File

@ -27,9 +27,6 @@
#
#############################################################################
runtime/cds/appcds/customLoader/HelloCustom.java 8289257 generic-all
runtime/cds/appcds/customLoader/HelloCustom_JFR.java 8289257 generic-all
runtime/cds/appcds/dynamicArchive/HelloDynamicCustomUnload.java 8289257 generic-all
resourcehogs/serviceability/sa/TestHeapDumpForLargeArray.java 8276539 generic-all
serviceability/sa/CDSJMapClstats.java 8276539 generic-all
serviceability/sa/ClhsdbJhisto.java 8276539 generic-all

View File

@ -73,7 +73,7 @@ public class HelloUnload {
}
URLClassLoader urlClassLoader =
new URLClassLoader("HelloClassLoader" + System.currentTimeMillis(), urls, null);
new URLClassLoader("HelloClassLoader", urls, null);
Class c = Class.forName(className, true, urlClassLoader);
if (keepAlive) {
keptC = c;
@ -99,22 +99,11 @@ public class HelloUnload {
ClassUnloadCommon.failIf(!wb.isClassAlive(className), "should be live here");
if (doUnload) {
String loaderName = urlClassLoader.getName();
int loadedRefcount = wb.getSymbolRefcount(loaderName);
System.out.println("Refcount of symbol " + loaderName + " is " + loadedRefcount);
urlClassLoader = null; c = null; o = null;
ClassUnloadCommon.triggerUnloading();
System.out.println("Is CustomLoadee alive? " + wb.isClassAlive(className));
ClassUnloadCommon.failIf(wb.isClassAlive(className), "should have been unloaded");
int unloadedRefcount = wb.getSymbolRefcount(loaderName);
System.out.println("Refcount of symbol " + loaderName + " is " + unloadedRefcount);
// refcount of a permanent symbol will not be decremented
if (loadedRefcount != 65535) {
ClassUnloadCommon.failIf(unloadedRefcount != (loadedRefcount - 1), "Refcount must be decremented");
}
}
}
}