JDK-8234823 : java/net/Socket/Timeouts.java testcase testTimedConnect2() fails on Windows 10
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_10
  • Submitted: 2019-11-26
  • Updated: 2021-11-29
  • Resolved: 2019-12-03
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.
JDK 11 JDK 14
11.0.14-oracleFixed 14 b26Fixed
Related Reports
Relates :  
Description
test Timeouts.testTimedConnect2(): failure
java.net.SocketTimeoutException: Connect timed out
	at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:546)
	at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:344)
	at java.base/java.net.Socket.connect(Socket.java:602)
	at Timeouts.testTimedConnect2(Timeouts.java:77)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:821)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1131)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
	at org.testng.TestRunner.privateRun(TestRunner.java:773)
	at org.testng.TestRunner.run(TestRunner.java:623)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
	at org.testng.SuiteRunner.run(SuiteRunner.java:259)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
	at org.testng.TestNG.run(TestNG.java:1018)
	at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:94)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:298)
	at java.base/java.lang.Thread.run(Thread.java:832)

Just raising the connect() timeout from 2000 to 2500 makes the test pass
Comments
Fix request (11u): Clean backport of a small test fix for Oracle 11.0.14 parity. Test still passes.
30-09-2021

URL: https://hg.openjdk.java.net/jdk/jdk/rev/d48638a26026 User: michaelm Date: 2019-12-03 11:55:37 +0000
03-12-2019

So, the same test passes on a very slow Virtual Box Windows 10 VM on my laptop. There is one significant config difference between the two environments. > netsh interface tcp show global Check the parameter Max SYN Retransmissions This was set to 4 on the OCI system, whereas it was only 2 on my VM. Windows waits for 500ms before retrying the connect request (yes, even in loopback on same system, when it's not likely to succeed after ECONNREFUSED). Four attempts takes 2 seconds whereas it was only 1 second on my VM, and that is fast enough for the tests in this case. Two seconds is right on the timeout limit used in the test. I just set the parameter to 2 on the OCI system, and the test passes now.
27-11-2019

The firewall has been disabled for all profiles: Get-NetFirewallProfile Name : Domain Enabled : False ... Name : Private Enabled : False ... Name : Public Enabled : False
26-11-2019

Could it be firewall config causing packets to be ignored?
26-11-2019

This test expects the connect to fail (connection refused), instead it seems that the connect to the "refusing endpoint" is hanging. Is there anything unique in the configuration of these Windows 10 systems that might explain this?
26-11-2019