[crac] RFR: Prevent concurrent cleanup by cleaner thread and checkpoint notifications
Anton Kozlov
akozlov at openjdk.org
Tue May 30 12:46:22 UTC 2023
On Thu, 25 May 2023 07:25:17 GMT, Radim Vansa <duke at openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java line 151:
>>
>>> 149: while (blockForCheckpoint) {
>>> 150: wait();
>>> 151: }
>>
>> Once we've got here, is it possible to ensure Cleaners has been called, and drop separate registration of Cleaners?
>>
>> A concurrent cleaner registration is not a problem, as that depends on GC which is not predictable. I.e. if that happens, a slight race may also cause the cleaner to run after restore.
>
> I don't follow. PhantomCleanableRefs are cleaned strictly after this point (these have later priority), other cleaners will be queued up by GC but not called until restore.
I mean, once we synchronized cleaner thread from picking up PhantomCleanableRefs, there is apparently no reason to go to the next priority and discover cleanups through registrations in the CRaC -- instead, all cleanups are discoverable thorugh the list maintained by the cleaner. It seems we can go through the list right from this Resource and run cleanups.
-------------
PR Review Comment: https://git.openjdk.org/crac/pull/73#discussion_r1210217106
More information about the crac-dev
mailing list