RFR: 8290848: LoadLibraryUnload.java still fails with "Too few cleared WeakReferences"

Roger Riggs rriggs at openjdk.org
Wed Jul 27 13:50:21 UTC 2022


On Tue, 26 Jul 2022 21:44:19 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

> The intermittent test failure was due to the WeakReferences being unreferenced too early.
> Adding a Reference.reachabilityFence to the test makes it robust.
> 
> Remove from ProblemList-Xcomp.txt

Hi Jai,

The actions related to References are only true if the Reference (or subtype) is reachable.
In this case, if the WeakReference cannot be reached from some other root, its semantics are void.

Note that initially the WeakReference refers to the queue not the other way around. 
Reference processing occurs from the roots and conditionally gaining semantics when traversing through Reference objects.
So at least until the weakly-reachable condition is satisfied the WeakReference must be reachable from another (strong) root.

https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/lang/ref/package-summary.html#reachability

-------------

PR: https://git.openjdk.org/jdk/pull/9649


More information about the core-libs-dev mailing list