hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kieran Kelleher <kieran_li...@mac.com>
Subject [HttpClient 3.0 RC2] executeMethod occasionly throws java.net.SocketException: Connection reset
Date Thu, 19 May 2005 00:41:46 GMT
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: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message