[crac] RFR: Handle open file descriptors with configurable policies [v4]
Radim Vansa
duke at openjdk.org
Mon Jun 12 15:12:14 UTC 2023
On Mon, 12 Jun 2023 15:04:47 GMT, Radim Vansa <duke at openjdk.org> wrote:
>> When the application does not close some file descriptors through Resources we can use `jdk.crac.fd-policy.checkpoint` and `jdk.crac.fd-policy.restore` to configure the behaviour.
>>
>> These properties can specify a list of File.pathSeparator-separated key=value pairs, where the key can be one of:
>>
>> * numeric file descriptor
>> * path using 'glob' pattern matching (see FileSystem.getPathMatcher() for details)
>> * keywords FIFO and SOCKET that match pipes and sockets
>>
>> The value should match one of possible values from OpenFDPolicies.BeforeCheckpoint and OpenFDPolicies.AfterRestore
>
> Radim Vansa has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains seven commits:
>
> - Refactor FileDescriptor resource to separate class
> - Add REOPEN_AT_END and OPEN_OTHER_AT_END policies
> - Merge branch 'crac' into newfd-policies
> - Effectively revert previous commit: Initialize logger in <clinit>
> - Simplify workarounds in SimpleConsoleLogger.<clinit>
> - Merge branch 'crac' into newfd-policies
> - Handle open file descriptors with configurable policies
>
> When the application does not close some file descriptors through
> Resources we can use `jdk.crac.fd-policy.checkpoint` and
> `jdk.crac.fd-policy.restore` to configure the behaviour.
>
> These properties can specify a list of File.pathSeparator-separated
> key=value pairs, where the key can be one of:
>
> * numeric file descriptor
> * path using 'glob' pattern matching (see FileSystem.getPathMatcher()
> for details)
> * keywords FIFO and SOCKET that match pipes and sockets
>
> The value should match one of possible values from
> OpenFDPolicies.BeforeCheckpoint and OpenFDPolicies.AfterRestore
Updated:
* merged-in last changes from `crac` branch
* added `REOPEN_AT_END` and `OPEN_OTHER_AT_END` policies
* refactored all the policy handling code into FileDescriptorResource (akin to JDKFileResource, name is not too important)
As for the checkpoint policy, the ERROR one probably won't be used (it's the default), so until we support some form of not closing the FD at all (replication use case) anything the user would set would boil down to CLOSE/WARN_CLOSE. Therefore, if you want to set it in a one big policy this would probably mean brain-dead duplication of the options.
If you want to present a few examples of how you'd like the user-facing options to look like, I am listening, but I don't see a better way myself.
-------------
PR Comment: https://git.openjdk.org/crac/pull/69#issuecomment-1587538322
More information about the crac-dev
mailing list