JDK-8259628 : jdk/net/ExtendedSocketOption/AsynchronousSocketChannelNAPITest.java fails intermittently
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 16
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-01-12
  • Updated: 2021-07-26
  • Resolved: 2021-01-28
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 16 JDK 17
16.0.1Fixed 17 b08Fixed
Related Reports
Relates :  
Description
[TestNG] Running:
  jdk/net/ExtendedSocketOption/AsynchronousSocketChannelNAPITest.java

config AsynchronousSocketChannelNAPITest.setup(): success
test AsynchronousSocketChannelNAPITest.testSetGetOptionServerSocketChannel(): success
test AsynchronousSocketChannelNAPITest.testSetGetOptionSocketChannel(): success
test AsynchronousSocketChannelNAPITest.testSocketChannel(): failure
java.nio.channels.ReadPendingException
	at java.base/sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:251)
	at java.base/sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:283)
	at AsynchronousSocketChannelNAPITest.testSocketChannel(AsynchronousSocketChannelNAPITest.java:114)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	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:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:298)
	at java.base/java.lang.Thread.run(Thread.java:831)

===============================================
jdk/net/ExtendedSocketOption/AsynchronousSocketChannelNAPITest.java
Total tests run: 3, Failures: 1, Skips: 0
===============================================

Comments
Fix Request Please approve this fix for 16u. This is a test fix only, and helps improve test stabilization. The patch applies cleanly, and the test passes.
12-02-2021

Changeset: 13ca433f Author: Patrick Concannon <pconcannon@openjdk.org> Date: 2021-01-28 15:01:38 +0000 URL: https://git.openjdk.java.net/jdk/commit/13ca433f
28-01-2021

there would appear to be a slight logic flaw in the test method testSocketChannel() clientID = ss.getOption(SO_INCOMING_NAPI_ID); // check ID remains consistent if (initialRun) { assertTrue(clientID >= 0, "AsynchronousSocketChannel: Receiver"); } else { assertEquals(clientID, tempID); initialRun = false; } it will always test for clientID >= 0 It is assumed the intent is that clientID should be the same for all reads ? So should the assignment initialRun = false; be executed after the first iteration? if (initialRun) { assertTrue(clientID >= 0, "AsynchronousSocketChannel: Receiver"); initialRun = false; } else { assertEquals(clientID, tempID); }
13-01-2021

This is a test bug, it should really wait (by calling Future.get) for the read to complete.
12-01-2021

Observed failing once on Linux 4.14.35-1818.3.3.el7uek.aarch64 (aarch64)
12-01-2021