hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: HttpClient blocks forever sometimes when open a HTTPS connection
Date Wed, 25 Nov 2009 20:51:39 GMT
diegopatr wrote:
> Hi all,
> 
> I'm using HTTPClient together with Axis 2. My threads executes thousands of
> calls to webservices per day. Sometimes those threads blocks forever, none
> of the timeouts are executed and I need to restart the application. I have
> researched everything in the net but I can't found a solution.
> 
> I put the logs in TRACE mode. The last log message when a thread became
> blocked is always the same:
> 
> DEBUG org.apache.commons.httpclient.HttpConnection - Open connection to
> xxx.xxx.xxx.xxx:443
> 
> The next message should be:
> 
> TRACE org.apache.commons.httpclient.HttpMethodBase - enter
> HttpMethodBase.execute(HttpState, HttpConnection)
> 
> Which blocking operations are doing between this two points?
> 

Socket connect and SSL handshaking, which A LOT


> I have one MultiThreadedHttpConnectionManager and one HTTPClient shared
> between all the threads.
> 
> I setup it using this code:
> 
>         HttpConnectionManagerParams cmparams = new
> HttpConnectionManagerParams();
>         cmparams.setSoTimeout(timeout);
>         cmparams.setDefaultMaxConnectionsPerHost(100);
>         cmparams.setMaxTotalConnections(500);
>         cmparams.setConnectionTimeout(timeout);
>         cmparams.setTcpNoDelay(true);
> 
>         HttpClientParams params = new HttpClientParams();
>         params.setSoTimeout(timeout);
>         params.setConnectionManagerTimeout(timeout);
> 
>         conmgr = new MultiThreadedHttpConnectionManager();
>         conmgr.setParams(cmparams);
> 
>         httpClient = new HttpClient(params, conmgr);
> 
> What you suggested to resolve this problem? 
> 

Implement a custom socket factory which would give you a complete 
control over the process of connection setup.

Also consider upgrading to HttpClient 4.0

Oleg

> Thanks,
> Diego Patricio
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message