Friday, 6 September 2013

PoolingClientConnectionManager PoolStats and potential connection leak concern

PoolingClientConnectionManager PoolStats and potential connection leak
concern

I'm using PoolingClientConnectionManager and I am suspecting that I'm
leaking connections. I have a monitoring thread that prints out the
PoolStats as below:
[leased: 126; pending: 0; available: 14; max: 140]
..
[leased: 140; pending: 20; available: 0; max: 140]
..
[leased: 140; pending: 10; available: 0; max: 140]
I spawn an equal number of threads to the number of pool connections
(140), so I was never expecting leased + pending > max. Is this assumption
valid ? Or is this a case of connections kept alive by the manager ? I'm
not sure if this case the connections are attributed to "lease" or
"available".
My suspicion is that I've that connection leaks might occur if the
HttpClient connection is interrupted during DNS resolve. In this scenario,
leased connections are not released back to the pool. Is there a suggested
way of de-allocating proper resources so that connections are properly
released back to the pool ?
Thanks in advance.

No comments:

Post a Comment