JDK-8251199 : javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java fails with Exception: Unexpected EOF
  • Type: Bug
  • Component: security-libs
  • Sub-Component: javax.net.ssl
  • Affected Version: 16
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86_64
  • Submitted: 2020-08-05
  • Updated: 2021-06-30
  • Resolved: 2021-04-05
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 17
17Resolved
Related Reports
Duplicate :  
Relates :  
Description
The following test failed in the JDK16 CI:

javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java

Here's a snippet from the log file:

#section:main
----------messages:(4/198)----------
command: main SSLSocketSSLEngineTemplate TLSv1.3
reason: User specified action: run main/othervm SSLSocketSSLEngineTemplate TLSv1.3 
Mode: othervm [/othervm specified]
elapsed time (seconds): 2.087
----------configuration:(0/0)----------
----------System.out:(49/1336)----------
-------------------------------------
Testing TLSv1.3 for direct buffers ...
Port: 47799
================
The format of the SSLEngineResult is: 
	"getStatus() / getHandshakeStatus()" +
	"bytesConsumed() / bytesProduced()"

server unwrap: OK/NEED_TASK, 478/0 bytes
	running delegated task...
	new HandshakeStatus: NEED_WRAP
----
server wrap: OK/NEED_WRAP, 0/127 bytes
================
server unwrap: OK/NEED_WRAP, 0/0 bytes
----
server wrap: OK/NEED_WRAP, 0/6 bytes
================
server unwrap: OK/NEED_WRAP, 0/0 bytes
----
server wrap: OK/NEED_UNWRAP, 0/709 bytes
================
server unwrap: OK/NEED_UNWRAP, 6/0 bytes
----
server wrap: OK/NEED_UNWRAP, 0/0 bytes
================
server unwrap: OK/NEED_WRAP, 90/0 bytes
----
server wrap: OK/FINISHED, 0/796 bytes
	...ready for application data
================
server unwrap: OK/NOT_HANDSHAKING, 86/48 bytes
----
server wrap: OK/NOT_HANDSHAKING, 30/68 bytes
================
server unwrap: BUFFER_UNDERFLOW/NEED_WRAP, 0/0 bytes
----
server wrap: CLOSED/NOT_HANDSHAKING, 0/40 bytes
================
server unwrap: OK/NOT_HANDSHAKING, 40/0 bytes
----
server wrap: CLOSED/NOT_HANDSHAKING, 0/0 bytes
================
##### Socket[addr=localhost/127.0.0.1,port=47799,localport=44870] #####
isBound: true
isConnected: true
isClosed: false
isInputShutdown: false
isOutputShutdown: false
----------System.err:(14/866)----------
java.lang.Exception: Unexpected EOF
	at SSLSocketSSLEngineTemplate.runTest(SSLSocketSSLEngineTemplate.java:271)
	at SSLSocketSSLEngineTemplate.main(SSLSocketSSLEngineTemplate.java:160)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	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.MainWrapper$MainThread.run(MainWrapper.java:127)
	at java.base/java.lang.Thread.run(Thread.java:832)

JavaTest Message: Test threw exception: java.lang.Exception: Unexpected EOF
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.lang.Exception: Unexpected EOF
----------rerun:(36/5683)*----------
Comments
The issue could have been fixed with JDK-8258753. Close it for now. If it happens again, please consider the following patch: $ git diff test/jdk/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java @@ -263,9 +263,9 @@ public class SSLSocketSSLEngineTemplate { len = is.read(inbound); if (len == -1) { logSocketStatus(clientSocket); - if (clientSocket.isClosed() + if (closed || clientSocket.isClosed() || clientSocket.isOutputShutdown()) { - log("Client socket was closed or shutdown output"); + log("Client socket was closed or is closing"); break; } else { throw new Exception("Unexpected EOF");
05-04-2021