[crac] RFR: Ensure empty Reference Handler and Cleaners queues [v2]

Dan Heidinga heidinga at openjdk.java.net
Mon Jan 31 20:36:43 UTC 2022


On Mon, 31 Jan 2022 12:51:22 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:

>> At the time of checkpoint, a set of References may need handling. This change ensures no References pending in ReferenceHandler and in Cleaners.
>> 
>> System.gc() is a best effort attempt to make GC to look for References. Default VM flags (-DisableExplicitGC, -ExplicitGCInvokesConcurrent) should not block the call, but additional investigation is needed to make sure GC found all references.
>
> Anton Kozlov has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
> 
>   Ensure empty Reference Handler and Cleaners queues

This seems like a reasonable approach to try out.  I'm not sold on the extra `notifyAll` in ReferenceQueue::remove but don't have a better suggestion.

src/java.base/share/classes/java/lang/ref/Reference.java line 344:

> 342:             @Override
> 343:             public void beforeCheckpoint(Context<? extends Resource> context) throws Exception {
> 344:                 System.gc();

Is a single `System.gc()` sufficient for the Hotspot collectors?  With OpenJ9, we used to treat back to back System.gc() calls specially as requiring extra effort.  Does Hotspot do something similar?

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

Marked as reviewed by heidinga (Committer).

PR: https://git.openjdk.java.net/crac/pull/13


More information about the crac-dev mailing list