Kieran, This problem is not uncommon. I know for a fact that the stale connection check does not work with older Sun JREs (< 1.4) when SSL is being used. I suspect the stale connection check is not always reliable with newer JREs as well.
I am afraid the only alternative is to disable the stale connection check altogether and to run an eviction thread which drops idle connections after a specified period of inactivity http://jakarta.apache.org/commons/httpclient/3.0/apidocs/org/apache/commons/httpclient/util/IdleConnectionTimeoutThread.html Oleg On Wed, May 18, 2005 at 08:41:46PM -0400, Kieran Kelleher wrote: > Hi, > > In brief, I get a SocketInputStream exception on > httpClient.executeMethod( postMethod ) intermittently and rarely, but > usually after connections to the host have been left idle for a few > minutes. My web application is using HttpClient library to process > multithreaded POST HTTPS requests to viaklix.com credit card service > provider. It seems the host is dropping the "keep-alive" connection > from the connection manager's pool so that that this exception is > thrown when the httpClient tries to use a connection that the > connection manager is trying to keep open. > > Logging indicates that the method has isRequestSent=true and > hasBeenUsed=false and http status code is unset consistently after the > exception is thrown. > > My short-term workaround (it works, but I don't longterm want to take > the chance of resending a credit card payment especially since > method.isRequestSent=true) is to use a retry handler on the method > since for the 1 in 50 times I have been able to reproduce the > exception, the cc service provider web application indicates that the > transaction was not processed. However rather than assuming that this > is going to always be the case, I really want to have some kind of > automatic stale connection checking done before my request is sent. > > Googling the list archives and examination of the HttpClient docs seem > to indicate that the > httpClient.getHttpConnectionManager().getParams().isStaleCheckingEnabled > () being TRUE may not be effective for SSL connections. > > Bottom line, is there anyway to have SSL connections checked reliably > by the connection manager (I'm using the > MultiThreadedHttpConnectionManager subclass) before it commits to > sending a request on a previously used SSL connection that it has in > its pool? > > The exception stacktrace looks like this: > > java.net.SocketException: Connection reset > at java.net.SocketInputStream.read(SocketInputStream.java:168) > at com.sun.net.ssl.internal.ssl.InputRecord.a(DashoA12275) > at com.sun.net.ssl.internal.ssl.InputRecord.read(DashoA12275) > at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275) > at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275) > at com.sun.net.ssl.internal.ssl.AppInputStream.read(DashoA12275) > at java.io.BufferedInputStream.fill(BufferedInputStream.java:183) > at java.io.BufferedInputStream.read(BufferedInputStream.java:201) > at > org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java: > 77) > at > org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105) > at > org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.jav > a:1110) > at > org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpCon > nectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1391) > at > org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBa > se.java:1824) > at > org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase > .java:1584) > at > org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java > :995) > at > org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMe > thodDirector.java:393) > at > org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMetho > dDirector.java:168) > at > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java: > 393) > at > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java: > 324) > at > ViaklixTransaction$TerminalTransactionProcess.run(ViaklixTransaction.jav > a:490) > at java.lang.Thread.run(Thread.java:552) > > > Regards, Kieran > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
