[crac] RFR: 8371549: [CRaC] Implement C/R in Selector on non-Linux [v2]
Timofei Pushkin
tpushkin at openjdk.org
Mon Jan 5 10:04:42 UTC 2026
On Mon, 1 Dec 2025 08:30:59 GMT, Radim Vansa <rvansa at openjdk.org> wrote:
>> Historically we have an extensive set of tests for java.nio.channels.Selector. However this runs only on Linux (using CRIU) rather than being platform agnostic and tested on all platforms. On Linux, it does not exercise PollSelectorImpl (this can be preferred using a system property) either - just the default EpollSelectorImpl.
>>
>> This PR enables testing on all available Selector implementations, cleans up the implementation of those tests and introduces the C/R implementations.
>
> Radim Vansa has updated the pull request incrementally with one additional commit since the last revision:
>
> Set FD value on Windows, too
I haven't read through `SelectorCRaCSupport` very carefully since it's mainly pre-existing code
src/java.base/share/classes/jdk/internal/crac/ClaimedFDs.java line 89:
> 87: assert fileDescriptorAccess.getHandle(entry.getKey()) != -1;
> 88: // On Windows the native FDs check is a no-op, but we need to set
> 89: // the FD to prevent assertion failure on Descriptor.getFd()
Maybe allow -1 as a value? Having 0 may be confusing as it is a valid FD value.
In the future, it looks like we need a more general abstraction for FD/handle.
src/java.base/share/classes/sun/nio/ch/SelectorCRaCSupport.java line 1:
> 1: package sun.nio.ch;
Missing license header
src/java.base/windows/classes/sun/nio/ch/WEPollSelectorImpl.java line 125:
> 123: @Override
> 124: protected Collection<FileDescriptor> claimFileDescriptors() {
> 125: // What about WEPoll eph?
Looks like this become a TODO/FIXME
test/jdk/jdk/crac/fileDescriptors/ReopenListeningWithSelectorTest.java line 48:
> 46: * @library /test/lib
> 47: * @modules java.base/jdk.internal.crac:+open
> 48: * @requires (os.family == "linux")
I haven't tested this but `PollSelectorProvider` is in `unix` directory so it should be available on other POSIX platforms. So maybe `os.family != "windows"`?
-------------
PR Review: https://git.openjdk.org/crac/pull/276#pullrequestreview-3625915226
PR Review Comment: https://git.openjdk.org/crac/pull/276#discussion_r2660931604
PR Review Comment: https://git.openjdk.org/crac/pull/276#discussion_r2660811552
PR Review Comment: https://git.openjdk.org/crac/pull/276#discussion_r2660888444
PR Review Comment: https://git.openjdk.org/crac/pull/276#discussion_r2660684061
More information about the crac-dev
mailing list