hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [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.
Date Thu, 12 May 2011 12:05:47 GMT

     [ 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


Mime
View raw message