From sdouglas at redhat.com Sat Mar 2 00:18:26 2013 From: sdouglas at redhat.com (Stuart Douglas) Date: Sat, 02 Mar 2013 19:18:26 +1100 Subject: OpenJDK HTTP Client Bug Message-ID: <5131B5D2.7090601@redhat.com> Hello everyone, (This is my first post to this list, so I am not 100% sure if this is the right place). I have run into a bug in the JDK HttpClient that was caused by a recent commit: http://hg.openjdk.java.net/jdk7u/jdk7u/jdk/diff/e6dc1d9bc70b/src/share/classes/sun/net/www/http/HttpClient.java The method sun.net.www.http.HttpClient#available() can throw java.net.SocketException, which can cause the creation of the HttpClient to fail. This will happen if there is a connection in the cache that has timed out and the socket has been closed. I have attached a small patch that should resolve the problem, although due to its intermittent nature I have not been able to verify with 100% certainty. The exception is: Caused by: java.net.SocketException: Socket Closed at java.net.PlainSocketImpl.getOption(PlainSocketImpl.java:286) at java.net.Socket.getSoTimeout(Socket.java:1032) at sun.net.www.http.HttpClient.available(HttpClient.java:356) at sun.net.www.http.HttpClient.New(HttpClient.java:273) at sun.net.www.http.HttpClient.New(HttpClient.java:310) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:987) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:923) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:841) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1031) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1410) This issue also seems to affect JDK 6, and it appears that other people have also run into this: http://stackoverflow.com/questions/14270311/rather-mysterious-socketexception-with-java-1-6-on-centos-4 I attempted to file a bug for this on the Oracle website, however as far as I can tell it was ignored. Stuart From luyaom at gmail.com Sun Mar 3 18:13:57 2013 From: luyaom at gmail.com (luyaom) Date: Mon, 4 Mar 2013 10:13:57 +0800 Subject: OpenJDK HTTP Client Bug In-Reply-To: <5131B5D2.7090601@redhat.com> References: <5131B5D2.7090601@redhat.com> Message-ID: I think "jdk7u-dev at openjdk.java.net" is the right place. Regards, Yunda 2013/3/2 Stuart Douglas > Hello everyone, > > (This is my first post to this list, so I am not 100% sure if this is the > right place). > > I have run into a bug in the JDK HttpClient that was caused by a recent > commit: > > http://hg.openjdk.java.net/**jdk7u/jdk7u/jdk/diff/** > e6dc1d9bc70b/src/share/**classes/sun/net/www/http/**HttpClient.java > > The method sun.net.www.http.HttpClient#**available() can throw > java.net.SocketException, which can cause the creation of the HttpClient to > fail. This will happen if there is a connection in the cache that has timed > out and the socket has been closed. > > I have attached a small patch that should resolve the problem, although > due to its intermittent nature I have not been able to verify with 100% > certainty. > > > The exception is: > > Caused by: java.net.SocketException: Socket Closed > at java.net.PlainSocketImpl.**getOption(PlainSocketImpl.**java:286) > at java.net.Socket.getSoTimeout(**Socket.java:1032) > at sun.net.www.http.HttpClient.**available(HttpClient.java:356) > at sun.net.www.http.HttpClient.**New(HttpClient.java:273) > at sun.net.www.http.HttpClient.**New(HttpClient.java:310) > at sun.net.www.protocol.http.**HttpURLConnection.**getNewHttpClient(** > HttpURLConnection.java:987) > at sun.net.www.protocol.http.**HttpURLConnection.**plainConnect(** > HttpURLConnection.java:923) > at sun.net.www.protocol.http.**HttpURLConnection.connect(** > HttpURLConnection.java:841) > at sun.net.www.protocol.http.**HttpURLConnection.**getOutputStream(** > HttpURLConnection.java:1031) > at org.apache.cxf.transport.http.**HTTPConduit$**WrappedOutputStream.* > *handleHeadersTrustCaching(**HTTPConduit.java:1410) > > > This issue also seems to affect JDK 6, and it appears that other people > have also run into this: http://stackoverflow.com/** > questions/14270311/rather-**mysterious-socketexception-** > with-java-1-6-on-centos-4 > > I attempted to file a bug for this on the Oracle website, however as far > as I can tell it was ignored. > > Stuart > >