[crac] RFR: Handle open file descriptors with configurable policies [v6]

Radim Vansa rvansa at openjdk.org
Thu Jun 15 12:22:30 UTC 2023

On Thu, 15 Jun 2023 11:27:43 GMT, Radim Vansa <rvansa at openjdk.org> wrote:

>> When the application does not close some file descriptors through Resources we can use `jdk.crac.file-policy.checkpoint`, `jdk.crac.file-policy.restore`, `jdk.crac.socket-policy.checkpoint` and `jdk.crac.socket-policy.checkpoint` to configure the behaviour.
>> These properties can specify a list of semicolon-separated key=value pairs, where the key can be one of:
>> * numeric file descriptor
>> * for `file-policy`, path using 'glob' pattern matching (see FileSystem.getPathMatcher() for details) - this matches named pipes, too
>> * for `file-policy` keyword `FIFO` matching all pipes (including anonymous)
>> * for `socket-policy` a `<local>,<remote>` pair, with the `<remote>` part being optional. Both `<local>` and `<remote>` can be unix socket path, IPv4/IPv6 address with optional colon and port number or wildcard `*` replacing any of those parts.
>> The possible values are in OpenFilePolicies.BeforeCheckpoint, OpenFilePolicies.AfterRestore, OpenSocketPolicies.BeforeCheckpoint and OpenSocketPolicies.AfterRestore enums.
> Radim Vansa has updated the pull request incrementally with one additional commit since the last revision:
>   cleanup

Merged in `crac` branch, and applied requested changes:
* The detection and policies now live in JDKFileResource and JDKSocketResource
* Policies for files and sockets are split

One thing I am not so sure about is location of some native methods - I've left what's used in `JDKFileResource` in `FileDispatcher_md.c`, and `JDKSocketResource` uses methods both in `UnixDomainSockets.c` and some are in `Net.c`. This might deserve own files, but I've reused what was in those files.


PR Comment: https://git.openjdk.org/crac/pull/69#issuecomment-1592937141

More information about the crac-dev mailing list