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 Claudio Degioanni <cl...@gmail.com> on 2016/10/10 17:16:45 UTC

org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool

Hi All,

I'm using the library Axis 2 version  1.7.3 with HttpClient 4.4.1, and
after 200 request the library throw a TimeoutException from connection pool.

From stacktrace I found the exeption is throw by the class
PoolingClientConnectionManager,
as reported below

Caused by: org.apache.axis2.AxisFault: Timeout waiting for connection from
pool
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
~[axis2-kernel-1.7.3.jar:1.7.3]
at org.apache.axis2.transport.http.impl.httpclient4.
HTTPSenderImpl.sendViaPost(HTTPSenderImpl.java:242)
~[axis2-transport-http-1.7.3.jar:1.7.3]
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:121)
~[axis2-transport-http-1.7.3.jar:1.7.3]
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.
writeMessageWithCommons(CommonsHTTPTransportSender.java:403)
~[axis2-transport-http-1.7.3.jar:1.7.3]
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(
CommonsHTTPTransportSender.java:234) ~[axis2-transport-http-1.7.3.jar:1.7.3]
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:431)
~[axis2-kernel-1.7.3.jar:1.7.3]
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:399)
~[axis2-kernel-1.7.3.jar:1.7.3]
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
~[axis2-kernel-1.7.3.jar:1.7.3]
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:150)
~[axis2-kernel-1.7.3.jar:1.7.3]
....
Caused by: org.apache.http.conn.ConnectionPoolTimeoutException: Timeout
waiting for connection from pool
at org.apache.http.impl.conn.PoolingClientConnectionManager.leaseConnection(
PoolingClientConnectionManager.java:226) ~[httpclient-4.4.1.jar:4.4.1]
at org.apache.http.impl.conn.PoolingClientConnectionManager$1.getConnection(
PoolingClientConnectionManager.java:195) ~[httpclient-4.4.1.jar:4.4.1]
at org.apache.http.impl.client.DefaultRequestDirector.execute(
DefaultRequestDirector.java:423) ~[httpclient-4.4.1.jar:4.4.1]
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:882)
~[httpclient-4.4.1.jar:4.4.1]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
~[httpclient-4.4.1.jar:4.4.1]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
~[httpclient-4.4.1.jar:4.4.1]
at org.apache.axis2.transport.http.impl.httpclient4.
HTTPSenderImpl.executeMethod(HTTPSenderImpl.java:873)
~[axis2-transport-http-1.7.3.jar:1.7.3]
at org.apache.axis2.transport.http.impl.httpclient4.
HTTPSenderImpl.sendViaPost(HTTPSenderImpl.java:238)
~[axis2-transport-http-1.7.3.jar:1.7.3]
... 15 common frames omitted


Search into code of library i found the configuration of connection pool:

 connManager = new PoolingClientConnectionManager(schemeRegistry);
 ((PoolingClientConnectionManager)connManager).setMaxTotal(200);
 ((PoolingClientConnectionManager)connManager).setDefaultMaxPerRoute(200);
  configContext.setProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER,
connManager);

The connection pool it's configured to have 200 connection for route, I
have made some test and my application fail after until 200 web service
request.

From log i see this line, to confim my idea:

2016-09-19 16:01:06| DEBUG   | Connection leased: [id: 199][route:
{s}-http://XXXX:443][total kept alive: 0; route allocated: 200 of 200;
total allocated: 200 of 200]
2016-09-19 16:01:09| DEBUG   | Connection request: [route:
{s}->http://XXXX:443][total kept alive: 0; route allocated: 200 of
200; total allocated: 200 of 200]

I think the connection pool use all available connections without release
it, after that throwing the exception.

I tried to write on Axis2 mail list without luck.

Any suggestions/test to solve the my problem ?

regs

Re: org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2016-10-10 at 19:16 +0200, Claudio Degioanni wrote:
> Hi All,
> 
> I'm using the library Axis 2 version  1.7.3 with HttpClient 4.4.1, and
> after 200 request the library throw a TimeoutException from connection pool.
> 
> From stacktrace I found the exeption is throw by the class
> PoolingClientConnectionManager,
> as reported below
> 
> Caused by: org.apache.axis2.AxisFault: Timeout waiting for connection from
> pool
> at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
> ~[axis2-kernel-1.7.3.jar:1.7.3]
> at org.apache.axis2.transport.http.impl.httpclient4.
> HTTPSenderImpl.sendViaPost(HTTPSenderImpl.java:242)
> ~[axis2-transport-http-1.7.3.jar:1.7.3]
> at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:121)
> ~[axis2-transport-http-1.7.3.jar:1.7.3]
> at org.apache.axis2.transport.http.CommonsHTTPTransportSender.
> writeMessageWithCommons(CommonsHTTPTransportSender.java:403)
> ~[axis2-transport-http-1.7.3.jar:1.7.3]
> at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(
> CommonsHTTPTransportSender.java:234) ~[axis2-transport-http-1.7.3.jar:1.7.3]
> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:431)
> ~[axis2-kernel-1.7.3.jar:1.7.3]
> at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:399)
> ~[axis2-kernel-1.7.3.jar:1.7.3]
> at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
> ~[axis2-kernel-1.7.3.jar:1.7.3]
> at org.apache.axis2.client.OperationClient.execute(OperationClient.java:150)
> ~[axis2-kernel-1.7.3.jar:1.7.3]
> ....
> Caused by: org.apache.http.conn.ConnectionPoolTimeoutException: Timeout
> waiting for connection from pool
> at org.apache.http.impl.conn.PoolingClientConnectionManager.leaseConnection(
> PoolingClientConnectionManager.java:226) ~[httpclient-4.4.1.jar:4.4.1]
> at org.apache.http.impl.conn.PoolingClientConnectionManager$1.getConnection(
> PoolingClientConnectionManager.java:195) ~[httpclient-4.4.1.jar:4.4.1]
> at org.apache.http.impl.client.DefaultRequestDirector.execute(
> DefaultRequestDirector.java:423) ~[httpclient-4.4.1.jar:4.4.1]
> at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:882)
> ~[httpclient-4.4.1.jar:4.4.1]
> at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
> ~[httpclient-4.4.1.jar:4.4.1]
> at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
> ~[httpclient-4.4.1.jar:4.4.1]
> at org.apache.axis2.transport.http.impl.httpclient4.
> HTTPSenderImpl.executeMethod(HTTPSenderImpl.java:873)
> ~[axis2-transport-http-1.7.3.jar:1.7.3]
> at org.apache.axis2.transport.http.impl.httpclient4.
> HTTPSenderImpl.sendViaPost(HTTPSenderImpl.java:238)
> ~[axis2-transport-http-1.7.3.jar:1.7.3]
> ... 15 common frames omitted
> 
> 
> Search into code of library i found the configuration of connection pool:
> 
>  connManager = new PoolingClientConnectionManager(schemeRegistry);
>  ((PoolingClientConnectionManager)connManager).setMaxTotal(200);
>  ((PoolingClientConnectionManager)connManager).setDefaultMaxPerRoute(200);
>   configContext.setProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER,
> connManager);
> 
> The connection pool it's configured to have 200 connection for route, I
> have made some test and my application fail after until 200 web service
> request.
> 
> From log i see this line, to confim my idea:
> 
> 2016-09-19 16:01:06| DEBUG   | Connection leased: [id: 199][route:
> {s}-http://XXXX:443][total kept alive: 0; route allocated: 200 of 200;
> total allocated: 200 of 200]
> 2016-09-19 16:01:09| DEBUG   | Connection request: [route:
> {s}->http://XXXX:443][total kept alive: 0; route allocated: 200 of
> 200; total allocated: 200 of 200]
> 
> I think the connection pool use all available connections without release
> it, after that throwing the exception.
> 
> I tried to write on Axis2 mail list without luck.
> 
> Any suggestions/test to solve the my problem ?
> 
> regs

Fix code that leaks connections.

Oleg


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