hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <o...@ok2consulting.com>
Subject Re: AysncHttpclient TimeoutException after 2 days of running
Date Thu, 11 Apr 2013 10:31:34 GMT
Jaikit Savla <jaikit@yahoo-inc.com> wrote:

>Hi Oleg,
>
>Thanks for suggestion. I enabled context logging and I ran 2 set of
>tests. One with connectionPerService set to 512 and another set to just
>1
>Case1: ConnectionsPerService: 512, TotalConnections: 12288
>2013-04-11 00:39:31 DefaultHttpAsyncClient [DEBUG] [exchange: 322920]
>Request connection for {}->http://xyz:80
>2013-04-11 00:39:31 PoolingClientAsyncConnectionManager [DEBUG]
>Connection request: [route: {}->http://xyz:80][total kept alive: 0;
>route allocated: 512 of 512; total allocated: 512 of 12288]
>
>After 322920 requests - all request fails with TimeoutException. 
>
>Case2: ConnectionsPerService: 1, TotalConnections: 5
>
>2013-04-11 01:09:33 DefaultHttpAsyncClient [DEBUG] [exchange: 54989]
>Request connection for {}->http://http://xyz:80
>2013-04-11 00:58:20 PoolingClientAsyncConnectionManager [DEBUG]
>Connection request: [route: {}->http://xyz:80][total kept alive: 0;
>route allocated: 1 of 1; total allocated: 1 of 5]
> 
>After 54989 - all request fails with TimeoutException
>
>I do not see any other exception other than TimeoutException after
>connectiontimeout which I set to 2s.
>
>I am not sure where the leak is :( . Any ideas ? Any other 
>
>Also can I use TimeToLive on leased connection to overcome leak ?
>
>Thanks,
>Jaikit
>
>
>
>
>On Wednesday, April 10, 2013 12:58 AM, Oleg Kalnichevski
><olegk@apache.org> wrote:
>On Tue, 2013-04-09 at 20:53 -0700, Jaikit Savla wrote:
>> My bad.. I pasted Ning client's initialization. Please find below
>Apache Httpclient initialization. 
>> 
>> PoolingClientAsyncConnectionManager connectionManager;
>> try {
>>     // Set up the scheme
>>     AsyncSchemeRegistry ymailRegistry =
>AsyncSchemeRegistryFactory.createDefault();
>>     DefaultConnectingIOReactor ioreactor = new
>DefaultConnectingIOReactor();
>>     connectionManager = new
>PoolingClientAsyncConnectionManager(ioreactor, ymailRegistry);
>> } catch (IOReactorException e) {
>>     throw new RuntimeException(e);
>> }
>>
>connectionManager.setDefaultMaxPerRoute(config.getMaxConnectionsPerService().intValue());
>> 
>>
>connectionManager.setMaxTotal(config.getMaxConnectionsTotal().intValue());
>> 
>> HttpAsyncClient client = new
>DefaultHttpAsyncClient(connectionManager);
>> 
>> 
>> Thanks
>
>
>Jaikit
>
>Apparently for some reason the connection manager runs out of
>connections (the total number of leased connections exceeds 12000).
>This
>suggests a connection leak. Could you please run your code with context
>logging for connection management / request execution turned on as
>described here?
>
>http://hc.apache.org/httpcomponents-client-ga/logging.html
>
>You should be able to see when connections start to pile up in the
>connection pool and what kind of request or condition may have lead to
>it. I can help analyzing the log. 
>
>You might want to reduce the connection pool size to minimum before
>running the test.
>
>Oleg
>
>> 
>> 2013-04-10 00:35:52 Sender$HttpCallback [WARN] Failed Http request:
>POST http://xyz/ HTTP/1.1 : duration(MS): 50529
>> java.util.concurrent.TimeoutException
>> at
>org.apache.http.nio.pool.AbstractNIOConnPool.processPendingRequests(AbstractNIOConnPool.java:244)
>> at
>org.apache.http.nio.pool.AbstractNIOConnPool.lease(AbstractNIOConnPool.java:192)
>> at
>org.apache.http.impl.nio.conn.PoolingClientAsyncConnectionManager.leaseConnection(PoolingClientAsyncConnectionManager.java:176)
>> at
>org.apache.http.impl.nio.client.DefaultAsyncRequestDirector.requestConnection(DefaultAsyncRequestDirector.java:629)
>> at
>org.apache.http.impl.nio.client.DefaultAsyncRequestDirector.start(DefaultAsyncRequestDirector.java:233)
>> at
>org.apache.http.impl.nio.client.AbstractHttpAsyncClient.execute(AbstractHttpAsyncClient.java:540)
>> at
>org.apache.http.impl.nio.client.AbstractHttpAsyncClient.execute(AbstractHttpAsyncClient.java:554)
>> at
>org.apache.http.impl.nio.client.AbstractHttpAsyncClient.execute(AbstractHttpAsyncClient.java:584)
>> at
>org.apache.http.impl.nio.client.AbstractHttpAsyncClient.execute(AbstractHttpAsyncClient.java:569)
>> at
>com.yahoo.jedi.events.vespa.VespaSender.sendUpdate(VespaSender.java:59)
>> at
>com.yahoo.jedi.events.vespa.FlagEventListener.onMessage(FlagEventListener.java:101)
>> at
>org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1321)
>> at
>org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:131)
>> at
>org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:202)
>> at
>org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:129)
>> at
>org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:47)
>> at
>java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>> at
>java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>> at java.lang.Thread.run(Thread.java:722)
>> 
>> Thanks
>> 
>> Jaikit
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>> 
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>For additional commands, e-mail: httpclient-users-help@hc.apache.org

Would you be able to upgrade to the latest snapshot off svn trunk, make sure your code doesnt
use any deprecated functionality, re-run the tests and pass the complete detailed logs onto
me? 

Oleg
-- 
Sent from my phone. Please excuse my brevity.

---------------------------------------------------------------------
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