[crac] RFR: Fix ordering of invocation on Resources [v2]
Radim Vansa
duke at openjdk.org
Tue Apr 25 11:57:42 UTC 2023
On Mon, 24 Apr 2023 13:33:31 GMT, Radim Vansa <duke at openjdk.org> wrote:
>> I realized that you actually asked for a different behaviour than what I thought initially, something like the `ConcurrentModificationException` while iterating a collection. That is not that bad, and we can add debug option to track where this happened.
>
> I figured out there is another problem with allowing the registration and failing afterwards: let's assume that you have two children contexts, C1 and C2. C1.beforeCheckpoint succeeds, and during C2.beforeCheckpoint you try to register something on C1. You suggest to allow this, but C1 won't be invoked and we cannot find that there's a new resource that should have failed the checkpoint - so it's kind of silently failing. The best you could do is to invoke the beforeCheckpoint on the resource when you find C1 to be done, but this is not what we discussed before.
Thinking about this again, the current code does not prevent that from happening either, had JDK context registered something new in the global context this would be silently ignored.
I can imagine that Core could keep a checkpoint counter and the Context would record last finished counter. During registration, if the current counter equals finished counter the registration could throw. However if we're to rollback the checkpoint, we would probably need to set a global flag in Core, too.
-------------
PR Review Comment: https://git.openjdk.org/crac/pull/60#discussion_r1176403873
More information about the crac-dev
mailing list