[crac] RFR: Synchronize concurrent clean() in PhantomCleanableRef

Anton Kozlov akozlov at openjdk.org
Mon May 15 14:10:17 UTC 2023


On Fri, 12 May 2023 14:45:15 GMT, Radim Vansa <duke at openjdk.org> wrote:

> I think that you won't avoid waiting for the cleanup thread - there would have to be a point in time where we'd switch a global (or per-resource?) flag to enter the blocking behavior (cannot be on all the time, because the checkpoint may never happen), and then wait for the in-flight resources to complete. It would be possible to achieve the synchronization through switching the flag on in the cleaner thread, but that only means waiting for it as well.

Agree, syncronization is required. What about adding a special synchronizing Ref added to the cleaner queue, so checkpoint can only proceed once the ref "cleanup" has been started? And which will block the cleaner until restore complete.

> All in all it seems much more complicated. Are you aware of any pros? 

Asking becauses synchronizing a single cleaner looks more efficient compared to syncronizing each PhantomCleanableRef. The performCleanup() is proposed to have an additional synchronized section, which is required only for CRaC.

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

PR Comment: https://git.openjdk.org/crac/pull/70#issuecomment-1547927252


More information about the crac-dev mailing list