RFR: 8293282: LoadLibraryUnloadTest.java fails with "Too few cleared WeakReferences"
Mandy Chung
mchung at openjdk.org
Thu Sep 8 20:56:46 UTC 2022
On Thu, 8 Sep 2022 20:26:41 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
> Modify the LoadLibraryUnload test to call gc() more a few times, allowing multiple gc cycles to queue the expected refs.
> Short the timeout on each cycle to 10 sec.
test/jdk/java/lang/ClassLoader/loadLibraryUnload/LoadLibraryUnload.java line 171:
> 169: dequeueCount++;
> 170: }
> 171: Asserts.assertEquals(dequeueCount, LOADER_COUNT, "Too few cleared WeakReferences");
This only invokes GC `LOADER_COUNT` times. I think you may want something like what ForceGC does:
int retries = (int)(Math.round(1000L * TIMEOUT_FACTOR) / 200);
for (; retries >= 0; retries--) {
if (dequeueCount == LOADER_COUNT) return;
System.gc();
refQueue.remove(200L);
}
-------------
PR: https://git.openjdk.org/jdk/pull/10223
More information about the core-libs-dev
mailing list