RFR: 8282726: java/net/vthread/BlockingSocketOps.java timeout/hang intermittently on Windows

Daniel Jeliński djelinski at openjdk.org
Tue Nov 21 09:36:10 UTC 2023


On Mon, 20 Nov 2023 16:08:10 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> This is a Windows specific issue where a virtual thread attempting to establish a connection appears to hang, and the test eventually times out. It initially looked like an issue on older releases of Windows but it turns out to be an issue that arises when a SOCKET handle is recycled quickly. Thanks to Daniel Jeliński for spending time to find a way to reproduce this quickly, up to now it was too intermittent and needed tens of thousands of runs to have some chance of reproducing.
> 
> When a SOCKET has been polled, the event is disabled rather than removed from wepoll / AFD poll. When the SOCKET is closed and immediately recycled then there is a race with the close event and registration of the "new" socket for events. The change that we've tested is to remove the event after polling. This is done virtual thread "client" rather than the poller to avoid racing with an async close.
> 
> As part of this change I've removed a temporary change to the Windows Pipe implementation and also remove the connect timeout that went into a few tests to workaround the issue.

LGTM. Thanks for fixing this!

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

Marked as reviewed by djelinski (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/16742#pullrequestreview-1741507555


More information about the nio-dev mailing list