[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jersey-dev] PoolingHttpClientConnectionManager not releasing connections
|
Hi,
hitting one more snag in the upgrade...
I was hoping that PoolingHttpClientConnectionManager is a drop-in
replacement for the deprecated ThreadSafeClientConnManager.
But with the seemingly identical configuration and the same
setDefaultMaxPerRoute(5) setting, our client connections started
hanging after reaching the per route limit:
PoolingHttpClientConnectionManager:266 - Connection request:
[route: {s}->https://localhost:4443][total kept alive: 0; route
allocated: 5 of 5; total allocated: 10 of 20]
Looking in the logs of the 1.19 version, it seems that the limit was
ignored - no connections available, but a new one is created anyway:
ThreadSafeClientConnManager:221 - Get connection:
HttpRoute[{s}->https://localhost:4443], timeout = 0
ConnPoolByRoute:350 - [HttpRoute[{s}->https://localhost:4443]]
total kept alive: 1, total issued: 0, total allocated: 1 out of 20
ConnPoolByRoute:523 - No free connections
[HttpRoute[{s}->https://localhost:4443]][null]
ConnPoolByRoute:369 - Available capacity: 5 out of 5
[HttpRoute[{s}->https://localhost:4443]][null]
ConnPoolByRoute:549 - Creating new connection
[HttpRoute[{s}->https://localhost:4443]]
So my questions are:
- is this the expected behavior of PoolingHttpClientConnectionManager?
Is it different from PoolingHttpClientConnectionManager?
- what do we do to avoid the client hanging?
- I suppose we need to introduce a (short) connection timeout - how do
we do that?
I've created a JerseyTest with our config that illustrates the problem:
Thanks
Martynas