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 <[email protected]> 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: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
