United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-7179879 : SSLSocket connect times out instead of throwing socket closed exception

Details
Type:
Bug
Submit Date:
2012-06-26
Status:
Closed
Updated Date:
2014-11-19
Project Name:
JDK
Resolved Date:
2012-08-07
Component:
security-libs
OS:
generic
Sub-Component:
javax.net.ssl
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Backport:
Backport:

Sub Tasks

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)

                                     
2013-06-20
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-comp/jdk/rev/35fec642fd32
                                     
2012-08-14
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.
                                     
2012-06-26



Hardware and Software, Engineered to Work Together