JDK-8281538 : java/lang/Thread/virtual/NetSockets.java and NioChannels.java timeout/hang intermittently on windows in loom repo
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: repo-loom
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2022-02-09
  • Updated: 2022-03-07
  • Resolved: 2022-03-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
repo-loomResolved
Related Reports
Relates :  
Description
The following tests timeout periodically in the loom repo:

java/lang/Thread/virtual/NetSockets.java#id0
java/lang/Thread/virtual/NetSockets.java#id1
java/lang/Thread/virtual/NioChannels.java#id0
java/lang/Thread/virtual/NioChannels.java#id1

There are at least two failure modes:

1. A timeout/hang with no additional information. It seems to only happen on Windows Server 2012 and Windows Server 2016 systems, I haven't seen any sightings on new releases of Windows.

2. A timeout/hang when re-running with WSAPollPoller where we see the following exception in the log:

 java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "java.util.Map.get(Object)" is null
	at java.base/sun.nio.ch.WSAPollPoller.processEvents(WSAPollPoller.java:212)
	at java.base/sun.nio.ch.WSAPollPoller.poll(WSAPollPoller.java:159)
	at java.base/sun.nio.ch.Poller.poll(Poller.java:363)
	at java.base/sun.nio.ch.Poller.pollLoop(Poller.java:270)
	at java.base/java.lang.Thread.run(Thread.java:1510)
	at java.base/jdk.internal.misc.InnocuousThread.run(InnocuousThread.java:162)
Comments
Most of the comments on this issue are about the experimental WSAPoll based Poller which is not currently used so I'm closing this issue a dup of JDK-8282726 to avoid the noise. For now, we are chasing an issue that is specific to older releases of Windows.
07-03-2022

A new sighting on Windows Server 2016. It appears to be an issue establishing a loopback connection and connect never wakes up. Below is the stack trace of the virtual thread that never wake ups. Windows issue KB4550945 may be related and may explain why we don't see the issue on Windows 10 or Windows Server 2019. java.base/jdk.internal.vm.Continuation.yield(Continuation.java:385) java.base/java.lang.VirtualThread.yieldContinuation(VirtualThread.java:351) java.base/java.lang.VirtualThread.park(VirtualThread.java:509) java.base/java.lang.System$2.parkVirtualThread(System.java:2584) java.base/jdk.internal.misc.VirtualThreads.park(VirtualThreads.java:60) java.base/java.util.concurrent.locks.LockSupport.park(LockSupport.java:369) java.base/sun.nio.ch.Poller.poll1(Poller.java:118) java.base/sun.nio.ch.Poller.poll(Poller.java:100) java.base/sun.nio.ch.Poller.poll(Poller.java:89) java.base/sun.nio.ch.NioSocketImpl.park(NioSocketImpl.java:175) java.base/sun.nio.ch.NioSocketImpl.park(NioSocketImpl.java:196) java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:590) java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) java.base/java.net.Socket.connect(Socket.java:664) java.base/java.net.Socket.connect(Socket.java:599) NetSockets$Connection.<init>(NetSockets.java:636) NetSockets.lambda$testSocketWriteAsyncClose$7(NetSockets.java:262) TestHelper.lambda$run$0(TestHelper.java:48) java.base/java.lang.VirtualThread.run(VirtualThread.java:270) java.base/java.lang.VirtualThread$VThreadContinuation.lambda$new$0(VirtualThread.java:155) java.base/jdk.internal.vm.Continuation.enter0(Continuation.java:355) java.base/jdk.internal.vm.Continuation.enter(Continuation.java:348)
10-02-2022