You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2011/05/12 14:05:47 UTC
[jira] [Resolved] (HTTPCLIENT-1084) Closing a timed out socket
takes the same amount of time as the connection took to time out, so the
perceived timeout for an application thread is 2 x timeout.
[ https://issues.apache.org/jira/browse/HTTPCLIENT-1084?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oleg Kalnichevski resolved HTTPCLIENT-1084.
-------------------------------------------
Resolution: Won't Fix
Daniel,
HttpClient 3.x codeline is at end of life and is no longer maintained or supported. I reviewed HttpClient 4.x code and believe it is not affected by the problem.
Please consider upgrading to HC 4.x.
Oleg
> Closing a timed out socket takes the same amount of time as the connection took to time out, so the perceived timeout for an application thread is 2 x timeout.
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: HTTPCLIENT-1084
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1084
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Affects Versions: 3.1 Final
> Reporter: Daniel Webster
> Priority: Minor
> Attachments: connection_close_fix.patch
>
>
> Closing a timed out socket takes the same amount of time as the connection took to time out, so the perceived timeout for an application thread is 2 x timeout.
> For example, say you set the timeout value for a connection using
> HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
> HttpConnectionManagerParams params = connectionManager.getParams();
> if(params == null){
> params = new HttpConnectionManagerParams();
> }
>
> params.setParameter(HttpConnectionManagerParams.SO_TIMEOUT, socketTimeout);
> params.setParameter(HttpConnectionManagerParams.CONNECTION_TIMEOUT, connectionTimeout);
> connectionManager.setParams(params);
> return connectionManager;
> If the client attempts to open a connection to a server and requests data, and the server fails to respond for 10 seconds, the HttpClient will actually throw a timeout exception to code using HttpClient after 20 seconds (2x10). The call pattern seems to be
> after 10 seconds, a ConnectionTimeoutException is thrown inside org.apache.commons.httpclient.HttpConnection.open(). The open() method then catches that exception (line 748) and calls closeSocketAndStreams() (on line 751). The closeSocketAndStream() method then takes another "timeout" seconds. This time is consumed when closing the output stream (lines 1222-1231).
> To fix this problem on our project, we switched the ordering of the socket shutdown and the stream shutdown (as shown in the attached patch).
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org