JDK-7179879 : SSLSocket connect times out instead of throwing socket closed exception
  • Type: Bug
  • Component: security-libs
  • Sub-Component: javax.net.ssl
  • Affected Version: 6
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-06-26
  • Updated: 2014-11-19
  • Resolved: 2012-08-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.
JDK 6 JDK 7 JDK 8
6u38Fixed 7u40Fixed 8 b51Fixed
Description
SHORT SUMMARY: Failure to close out an SSL socket if connection has not 
completed
INDICATORS: Timeout of SSLSocket connection instead of a socket closed 
exception during connect
COUNTER INDICATORS:
TRIGGERS: See bugDB report
KNOWN WORKAROUND: Perhaps the system setting for socket timeout can be 
reduced but may not be suitable
PRESENT SINCE: N/A
HOW TO VERIFY: Will write up a JTREG test from sample testcase included
NOTES FOR SE: 
Closing of SSL sockets is ignored if SSL session state is still at cs_START. 
We shouldn't ignore close requests where connect operations get interrupted.

REGRESSION: No.

Comments
Marking this as verified based on the sample program from Bug DB /java/re/jdk/8/nightly-tl/ws/build/solaris-amd64/j2sdk-image/bin/java -cp sol NewSSLSocketTest 141.146.118.10 4466 15:04:50:220 Before Calling Socket Connect Call Socket Closed Statetrue socket closed successfully From Socket Close15:05:02:70 From Exception:15:05:02:71 java.net.SocketException: Socket closed at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:581) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:641) at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173) at NewSSLSocketTest.main(NewSSLSocketTest.java:53)
20-06-2013

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-comp/jdk/rev/35fec642fd32
14-08-2012

EVALUATION The SSLSocketImpl class needs correcting so that we close out the underlying socket when a connect call is interrupted with a close() request, even if SSL state is at cs_START mode.
26-06-2012