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

Radim Vansa duke at openjdk.org
Fri Jun 9 10:19:17 UTC 2023

On Thu, 8 Jun 2023 18:17:15 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:

>> Radim Vansa has updated the pull request incrementally with one additional commit since the last revision:
>>   Effectively revert previous commit: Initialize logger in <clinit>
> src/java.base/share/classes/jdk/crac/impl/OpenFDPolicies.java line 228:
>> 226:             return fifoPolicy;
>> 227:         } else if (type.equals("socket")) {
>> 228:             return socketPolicy;
> Obviously, only a single policy is possible for all sockets. In general sockets are much harder than files, and in not so many cases we can automatically handle them. I think some connection-less sockets _may_ be covered, and some listening sockets.
> If we continue this implementation, FileDescriptor (a rather simple object intially) will grow larger and larger, knowing about all possible uses in the JDK.

Someone already asked for automatic reopening of listening sockets. The policy could then e.g. filter specific ports (similar to files). Yes, you can't to anything but KEEP_CLOSED for sockets related to connection. I assume that the restore policy will be set during restore, rather than during checkpoint, so there's no chance to handle a non-sense configuration during checkpoint (because the configuration is not present yet).

Growing FileDescriptor has a point, any complex implementation for sockets should be hosted next to other Socket related stuff. For files, I don't know if there's a better place, but we could refactor it to an util class.


PR Review Comment: https://git.openjdk.org/crac/pull/69#discussion_r1224123951

More information about the crac-dev mailing list