[crac] RFR: Fix ordering of invocation on Resources

Radim Vansa duke at openjdk.org
Mon Apr 24 06:52:16 UTC 2023


On Fri, 21 Apr 2023 17:04:17 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:

>> * When Context.beforeCheckpoint throws, invoke Context.afterRestore anyway (otherwise some resources stay in suspended state).
>> * Handle Resource.beforeCheckpoint triggering a registration of another resource ** Do not cause deadlock when registering from another thread ** Global resource can register JDKResource
>> ** JDKResource can register resource with higher priority ** Other registrations are prohibited
>
> src/java.base/share/classes/jdk/crac/impl/AbstractContextImpl.java line 117:
> 
>> 115:                     restoreQ.add(r);
>> 116:                 } catch (CheckpointException e) {
>> 117:                     enqueueIfContext(r);
> 
> Ohh, I see the problem
> 
>> When Context.beforeCheckpoint throws, invoke Context.afterRestore anyway (otherwise some resources stay in suspended state).
> 
> So this is proposed to be handled in the parent context? Have you considered fixing that in the child context, run afterRestore for successfully checkpointed resources, before throwing CheckpointException to the parent context?

Right now we run the checkpoint for all resources even if some fail. Are you fine with erroring out on the first exception?

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

PR Review Comment: https://git.openjdk.org/crac/pull/60#discussion_r1174852349


More information about the crac-dev mailing list