JDK-8255627 : (se) Non-blocking I/O error in java.nio still exists (windows)
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 8u191
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2020-10-27
  • Updated: 2023-08-10
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
tbdUnresolved
Description
ADDITIONAL SYSTEM INFORMATION :
os: Windows 10.
jdk: java version "1.8.0_191" Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

A DESCRIPTION OF THE PROBLEM :
Recently, I found that java.nio (windows) can't block, invoke selector.select(1000) without connect event, but it just return.
I notice JDK-4408470 is the same issue, but it signed solved. In fact, some people still meet this case.
Some open source meet same case. 
netty: https://github.com/netty/netty/issues/3857
jetty: https://github.com/netty/netty/issues/3857

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
step1. Find a windows pc.

step2. Install HttpDebugger

step3. Run application which use nio selector.select()

step4. Wait 2 hours

step5. CPU spikes

HttpDebugger looks to be an application that uses Windows Layered Service Provider or Windows Filtering Platform to do proxy-less network interception.

ACTUAL -
cpu spikes

FREQUENCY : always



Comments
Thanks. As I said, I suspect the uninstall breaks the loopback connection. One thing we could do is change setWakeupSocket0 / resetWakeupSocket0 to check if send/recv fail and maybe we can get more information.
02-11-2020

[~alanb] The steps are as follows: 1) execute test.java 2) while the program is running, uninstall HttpDebugger and the issue reproduces when uninstallation starts.
02-11-2020

[~sswsharm] Would it be possible to test with JDK 15 or the current JDK 16 EA build to see if you can reproduce it there too? There are no channels registered so surprising that select wakeup, I can only guess that there is some interference with the wakeup mechanism. Do you know if HttpDebugger intercepts connections through the loopback?
02-11-2020

Issue is reproduced on JDK 8u271/Windows 10, execution video is attached(test.mp4) Additional information from submitter via mail: =============================================== I have tried used 1.8.0_271, the problem still exist. you can see it in my video. =============================================== Moving it to dev team for further analysis.
02-11-2020

Additional Information from submitter: =========================== the test code: public static void main(String[] args) throws InterruptedException, IOException { Selector selector = Selector.open(); while (true) { int select = selector.select(); if (select == 0) { System.out.println("windows nio bug happen"); } } } And now I find a quick way to reproduce it. Step 1: run test code Step 2: uninstall the httpdebugger Step 3: windows nio bug occur
02-11-2020

Thanks for the update but can you clarify the steps to duplicate this? It looks like the test is run and while it is running that HttpDebugger is uninstalled - is that correct? If so then I maybe the the uninstall is removing a hook and somehow causing the loopback connection (used by the Selector wakeup mechanism) to break.
02-11-2020

Requested additional information from submitter: ====================================== The issue that you have reported is against jdk 8u191 which is quite old, could you please let us know if this issue also exists with latest JDK 8u271 ? https://www.oracle.com/in/java/technologies/javase/javase-jdk8-downloads.html Also, to understand the issue better, please provide a simple standalone test case to reproduce this issue. ======================================
30-10-2020