[crac] RFR: Prevent concurrent cleanup by cleaner thread and checkpoint notifications
Radim Vansa
duke at openjdk.org
Thu May 25 06:59:19 UTC 2023
On Wed, 24 May 2023 13:16:43 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:
>> We block the cleaner thread to prevent race conditions between this thread and checkpointing thread invoking clean().
>> When the cleanup starts in cleaner thread the checkpoint will skip it, but without waiting for the cleanup to finish (which might be critical for the checkpoint, e.g. closing FDs).
>> The limitation is that code performing C/R must not wait on any task completed by the cleaner.
>
> src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java line 182:
>
>> 180: // completed by the cleaner.
>> 181: blockForCheckpoint = true;
>> 182: thread.interrupt();
>
> Why it has to be interrupt and not notify(), for example?
The interrupt wakes up cleaner in `queue.remove()` (line 161) in case it's blocking for next task.
-------------
PR Review Comment: https://git.openjdk.org/crac/pull/73#discussion_r1205075139
More information about the crac-dev
mailing list