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 Fang Lin <Fa...@u.washington.edu> on 2011/07/21 20:47:28 UTC

ConnectionPoolTimeoutException

Often getting org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection
        at org.apache.http.impl.conn.tsccm.ConnPoolByRoute.getEntryBlocking(ConnPoolByRoute.java:417)
        at org.apache.http.impl.conn.tsccm.ConnPoolByRoute$1.getPoolEntry(ConnPoolByRoute.java:300)
        at org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager$1.getConnection(ThreadSafeClientConnManager.java:224)
        at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:391)
        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
when there were only two active connections in a ConnPoolByRoute whose  max connection is set to 10.
This case happened with some routes but not all routes. Once it started, only restarting tomcat would fix the issue.
Any suggestion?


Httpclient 4.1.1, httpcore 4.1.2

Java(TM) SE Runtime Environment (build 1.6.0_23-b05) Java HotSpot(TM) 64-Bit Server VM (build 19.0-b09, mixed mode)






RE: ConnectionPoolTimeoutException

Posted by Fang Lin <Fa...@u.washington.edu>.
That's exactly the case in my situation. Thank you both!!
-----Original Message-----
From: Sam Crawford [mailto:samcrawford@gmail.com] 
Sent: Friday, July 22, 2011 5:55 AM
To: HttpClient User Discussion
Subject: Re: ConnectionPoolTimeoutException

My experience leads me to agree with Oleg. I would suggest adding logging for connection management (see http://hc.apache.org/httpcomponents-client-ga/logging.html).

Make sure you're always consuming the content when handling responses.
When I first began working with HttpClient I was aborting our response handling process if I saw a non-2xx/3xx response code *without* consuming the response - this led to the connection not being evicted.

Thanks,

Sam


On 22 July 2011 13:26, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Thu, 2011-07-21 at 18:47 +0000, Fang Lin wrote:
>> Often getting org.apache.http.conn.ConnectionPoolTimeoutException: 
>> Timeout waiting for connection
>>         at 
>> org.apache.http.impl.conn.tsccm.ConnPoolByRoute.getEntryBlocking(Conn
>> PoolByRoute.java:417)
>>         at 
>> org.apache.http.impl.conn.tsccm.ConnPoolByRoute$1.getPoolEntry(ConnPo
>> olByRoute.java:300)
>>         at 
>> org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager$1.getConn
>> ection(ThreadSafeClientConnManager.java:224)
>>         at 
>> org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultReq
>> uestDirector.java:391)
>>         at 
>> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpCl
>> ient.java:820) when there were only two active connections in a 
>> ConnPoolByRoute whose  max connection is set to 10.
>> This case happened with some routes but not all routes. Once it started, only restarting tomcat would fix the issue.
>> Any suggestion?
>>
>>
>> Httpclient 4.1.1, httpcore 4.1.2
>>
>> Java(TM) SE Runtime Environment (build 1.6.0_23-b05) Java HotSpot(TM) 
>> 64-Bit Server VM (build 19.0-b09, mixed mode)
>>
>
> I suspect your code is leaking connections.
>
> Oleg
>
>
>
> ---------------------------------------------------------------------
> 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


Re: ConnectionPoolTimeoutException

Posted by Sam Crawford <sa...@gmail.com>.
My experience leads me to agree with Oleg. I would suggest adding
logging for connection management (see
http://hc.apache.org/httpcomponents-client-ga/logging.html).

Make sure you're always consuming the content when handling responses.
When I first began working with HttpClient I was aborting our response
handling process if I saw a non-2xx/3xx response code *without*
consuming the response - this led to the connection not being evicted.

Thanks,

Sam


On 22 July 2011 13:26, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Thu, 2011-07-21 at 18:47 +0000, Fang Lin wrote:
>> Often getting org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection
>>         at org.apache.http.impl.conn.tsccm.ConnPoolByRoute.getEntryBlocking(ConnPoolByRoute.java:417)
>>         at org.apache.http.impl.conn.tsccm.ConnPoolByRoute$1.getPoolEntry(ConnPoolByRoute.java:300)
>>         at org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager$1.getConnection(ThreadSafeClientConnManager.java:224)
>>         at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:391)
>>         at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
>> when there were only two active connections in a ConnPoolByRoute whose  max connection is set to 10.
>> This case happened with some routes but not all routes. Once it started, only restarting tomcat would fix the issue.
>> Any suggestion?
>>
>>
>> Httpclient 4.1.1, httpcore 4.1.2
>>
>> Java(TM) SE Runtime Environment (build 1.6.0_23-b05) Java HotSpot(TM) 64-Bit Server VM (build 19.0-b09, mixed mode)
>>
>
> I suspect your code is leaking connections.
>
> Oleg
>
>
>
> ---------------------------------------------------------------------
> 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


Re: ConnectionPoolTimeoutException

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2011-07-21 at 18:47 +0000, Fang Lin wrote:
> Often getting org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection
>         at org.apache.http.impl.conn.tsccm.ConnPoolByRoute.getEntryBlocking(ConnPoolByRoute.java:417)
>         at org.apache.http.impl.conn.tsccm.ConnPoolByRoute$1.getPoolEntry(ConnPoolByRoute.java:300)
>         at org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager$1.getConnection(ThreadSafeClientConnManager.java:224)
>         at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:391)
>         at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
> when there were only two active connections in a ConnPoolByRoute whose  max connection is set to 10.
> This case happened with some routes but not all routes. Once it started, only restarting tomcat would fix the issue.
> Any suggestion?
> 
> 
> Httpclient 4.1.1, httpcore 4.1.2
> 
> Java(TM) SE Runtime Environment (build 1.6.0_23-b05) Java HotSpot(TM) 64-Bit Server VM (build 19.0-b09, mixed mode)
> 

I suspect your code is leaking connections.

Oleg



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