You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by diegopatr <di...@gmail.com> on 2009/11/25 12:13:23 UTC

HttpClient blocks forever sometimes when open a HTTPS connection

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?

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? 

Thanks,
Diego Patricio


-- 
View this message in context: http://old.nabble.com/HttpClient-blocks-forever-sometimes-when-open-a-HTTPS-connection-tp26510963p26510963.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


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


Re: HttpClient blocks forever sometimes when open a HTTPS connection

Posted by Oleg Kalnichevski <ol...@apache.org>.
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