I am attempting the scenario you describe and am having similar yet different results. For me, the problem occurs in both 2.0 as well as 2.1. Also, I am getting an exception in HttpConnection.isResponseAvailable() when the SO_TIMEOUT is reset in the finally clause. Most likely the difference in behavior is due to different SSL implementations and how they handle IO once a socket is stale/closed. SSL seems to be quite non-standard across JVMs.
The stack trace you include below is actually not an error. It is part of the standard process of determining if a connection is stale. The stack trace is printed on DEBUG and is meant for just that purpose. Having said that, it seems there are a number of other areas where SO_TIMEOUT is set(like in HttpConnection.isResponseAvailable()) that are potential problems. It seems that we should catch the SocketExceptions in these other cases and do something more robust.
What does everyone else think?
Mike
My test code:
Protocol.registerProtocol(
"https",
new Protocol("https", new EasySSLProtocolSocketFactory(), 443));
HttpClient client = new HttpClient();
HeadMethod head = new HeadMethod("https://www.biomedcentral.com/info/about/peerreview");
head.setBodyCheckTimeout(500);
client.executeMethod(head);
head.releaseConnection();
On Thursday, September 4, 2003, at 10:12 AM, [EMAIL PROTECTED] wrote:
Hi,
I'm using the latest build from gump and I've found out that setting the option setBodyCheckTimeout(500) (which I need because I perform HEAD requests to a lot of different servers) results in the connection not being properly closed. This happens with the url
https://www.biomedcentral.com/info/about/peerreview
this doesn't happen using commons-httpclient-2.0-rc1.jar build..
Any suggestions?
many thanks in advance
My log:
1238 DEBUG [Thread-1] methods.HeadMethod - Check for non-compliant response body. Timeout in 500
ms
1238 DEBUG [Thread-1] httpclient.HttpConnection - enter HttpConnection.isResponseAvailable(int)
1241 DEBUG [Thread-1] httpclient.HttpConnection - Input data not available
1241 DEBUG [Thread-1] httpclient.HttpConnection - enter HttpConnection.releaseConnection()
1241 DEBUG [Thread-1] httpclient.HttpConnection - Releasing connection back to connection manager
.
1262 DEBUG [Thread-1] httpclient.HttpConnection - An error occurred while reading from the socket
, is appears to be stale
java.net.SocketException: Socket Closed
at java.net.PlainSocketImpl.setOption(PlainSocketImpl.java:177)
at java.net.Socket.setSoTimeout(Socket.java:898)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.setSoTimeout(DashoA6275)
at org.apache.commons.httpclient.HttpConnection.isStale(HttpConnection.jav a:465)
at org.apache.commons.httpclient.HttpConnection.isOpen(HttpConnection.java :396)
at org.apache.commons.httpclient.SimpleHttpConnectionManager.getConnection WithTimeout(Simpl
eHttpConnectionManager.java:144)
at org.apache.commons.httpclient.HttpMethodDirector.establishValidOpenConn ection(HttpMethod
Director.java:231)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethodForHost(H ttpMethodDirector
.java:306)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMeth odDirector.java:1
43)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java: 378)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java: 268)
at CheckClient.run(CheckClient.java:190)
1265 DEBUG [Thread-1] httpclient.HttpConnection - Connection is stale, closing...
1265 DEBUG [Thread-1] httpclient.HttpConnection - enter HttpConnection.close()
1265 DEBUG [Thread-1] httpclient.HttpConnection - enter HttpConnection.closeSockedAndStreams()
---------------------------------------------------------------------
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]
