[crac] RFR: 8349560: [CRaC] Close EPoll FDs when FD policies close registered sockets [v2]

Radim Vansa rvansa at openjdk.org
Wed Feb 12 17:24:23 UTC 2025


On Wed, 12 Feb 2025 17:01:15 GMT, Radim Vansa <rvansa at openjdk.org> wrote:

>> FD policies are applied as the last set of JDK resources. When these are meant to close server sockets, it’s rather too late: open EPoll FDs won’t be closed automatically as these have the socket still registered when the automatic close is performed.
>> 
>> We can apply FD policies on sockets and close these if requested before EPoll FD handling. The downside is that we would not handle sockets opened during checkpoint, but generally the application should not do that. 
>> 
>> Besides changing the order of closing this PR also improves the way EPoll FDs are reported: the Selector throws BusySelectorException listing channels registered on that selector, and EPoll FD and Event Epoll FD are claimed through Java code with message referencing the selector (this suppresses native open FD detection that wouldn't provide much info).
>
> Radim Vansa has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Use IOUtil.newFd rather than FileDescriptorAccess
>  - Change Pollers priority to NORMAL

So it turns out this was really an issue. `Pollers` wake up the epoll/wepoll/kqueue by registering a (new) pipe and writing a byte into that. Regrettably on Windows the implementation of pipe uses localhost sockets and moving the socket-handling code earlier interfered with this.
I've solved this by registering Pollers at NORMAL priority; the registration at EPOLLSELECTOR priority was rather arbitrary; let's see if the testsuite works now.

-------------

PR Comment: https://git.openjdk.org/crac/pull/202#issuecomment-2654383107


More information about the crac-dev mailing list