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

9,736 views
Skip to first unread message

j...@obecon.net

unread,
May 15, 2011, 11:25:15 AM5/15/11
to ektorp-discuss
Hi,
my application is experiencing an
"org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting
for connection" once in a while. I'm wondering if any of your guys
experienced the same. I just start digging into this and stumbled over
the following in the apache HttpClient documentation:

"ThreadSafeClientConnManager maintains a maximum limit of connections
on a per route basis and in total. Per default this implementation
will create no more than 2 concurrent connections per given route".

Maybe increasing the limit of 'connections per route' will solve the
problem, has anyone tried?

Thanks in advance
Janne

j...@obecon.net

unread,
May 15, 2011, 12:08:20 PM5/15/11
to ektorp-discuss
To answer my self: maxConnections set via spring / couchdb.properties
in ektorp is used to set maxConnectionsPerRoute allready. So I will
just try to increase the number of allowed connections per se.

Greetings Janne

j...@obecon.net

unread,
May 17, 2011, 10:11:30 AM5/17/11
to ektorp-discuss
OK, seems that neither increasing maxConnections nor an update to http-
client 4.1.1 solves the problem. I'm still getting
ConnectionPoolTimeoutExceptions. Any ideas are appriciated.

Greetings Janne

henrik.lundgren

unread,
May 17, 2011, 10:17:10 AM5/17/11
to ektorp-discuss
What is your usage pattern?

Do you use getAsStream, queryForStream or getAttachment?
In that case verify that the streams are closed after usage at all
times, otherwise you will get connection leaks.

/Henrik

thaichat04

unread,
Jul 12, 2011, 8:20:00 AM7/12/11
to ektorp-discuss
I've got the same problem, and fixed by close well the InputStream
after getAttachment.

Thank Henrik

On May 17, 4:17 pm, "henrik.lundgren" <carl.henrik.lundg...@gmail.com>
wrote:

reali...@gmail.com

unread,
Apr 1, 2014, 9:12:02 PM4/1/14
to ektorp-...@googlegroups.com
I am experiencing a problem with this , it tells that i have to connect in here,what should i do?

Henrik Lundgren

unread,
Apr 2, 2014, 2:29:23 AM4/2/14
to ektorp-...@googlegroups.com
you probably have a connection leak somewhere.
there are a few cases where you have to remember to close the stream. attachments for instance.

//Henrik

2 apr 2014 kl. 03:12 skrev reali...@gmail.com:

> I am experiencing a problem with this , it tells that i have to connect in here,what should i do?
>
> --
> You received this message because you are subscribed to the Google Groups "ektorp-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ektorp-discus...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

kitt...@gmail.com

unread,
Apr 2, 2014, 3:59:59 PM4/2/14
to ektorp-...@googlegroups.com
I have the same problem and i found the fix.
This timeout is because of a connection leak. In my case i'm using httpDelete method and not consuming the response. Instead, checking the status of the response. 

The fix is, the response entity need to be consumed.  In order to ensure proper release of system resources one must close the content stream associated with the entity.

So i used  EntityUtils.consumeQuietly(response.getEntity()); which  ensures that the entity content is fully consumed and the content stream, if exists, is closed.

mubar...@gmail.com

unread,
Dec 25, 2014, 7:13:26 PM12/25/14
to ektorp-...@googlegroups.com
Face book logon
Reply all
Reply to author
Forward
0 new messages