JDK-8013824 : sun.net.www.http.HttpClient#available() does not check server socket closed
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows
  • CPU: generic
  • Submitted: 2013-04-04
  • Updated: 2014-11-17
  • Resolved: 2013-05-02
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version  " 1.6.0_38 " 
Java(TM) SE Runtime Environment (build 1.6.0_38-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.13-b02, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Windows 7 64-bit

A DESCRIPTION OF THE PROBLEM :
We are getting sporadic failures in SOAP requests. The underlying problem appears to be in the the new available method introduced in bug 8000410. It does not check if the serverSocket field is closed before calling getSoTimeout on it.

I'm not totally sure if this is actually a bug or due to misuse of HttpClient (it's being called by Apache CXF).

This never happened in 6.0.37.

REGRESSION.  Last worked in version 6u31


ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.net.SocketException: Socket Closed
at java.net.PlainSocketImpl.getOption(PlainSocketImpl.java:286) [rt.jar:1.6.0_38]
at java.net.Socket.getSoTimeout(Socket.java:1032) [rt.jar:1.6.0_38]
at sun.net.www.http.HttpClient.available(HttpClient.java:356) [rt.jar:1.6.0_38]
at sun.net.www.http.HttpClient.New(HttpClient.java:273) [rt.jar:1.6.0_38]
at sun.net.www.http.HttpClient.New(HttpClient.java:310) [rt.jar:1.6.0_38]
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:987) [rt.jar:1.6.0_38]
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:923) [rt.jar:1.6.0_38]
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:841) [rt.jar:1.6.0_38]
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1031) [rt.jar:1.6.0_38]


REPRODUCIBILITY :
This bug can be reproduced occasionally.