On Wed, 2014-05-14 at 16:48 -0700, Jaikit Savla wrote:
> Folks,
> 
> Is there a way to reclaim connections once they are leaked ? For testing I 
> configured a client with maxconnectionperservice=1 and 
> IdleConnectionMonitorThread running every 5 seconds. My test is leaking 
> connection and once it runs 1 test, it fails with 
> ConnectionPoolTimeoutException. From the wire log I do see connection being 
> made after request 1 even though I allocated just 1 connection per host. But 
> test fails with ConnectionPoolTimeoutException as expected. I am running with 
> httpclient-4.3.3
> 
> Should IdleConnectionMonitorThread clean up leaked connections ? If not - is 
> there any other suggestion to handle buggy code leaking connections ?

Connection manager simply has no way of knowing weather or not a
connection is still being used. Therefore no matter what you do there is
always a chance of shutting down a perfectly valid connection currently
blocked waiting for input.

My advice would be to fix buggy code. 

Oleg

> Please find attached wire log. 
> 
> Test case:
>     @Test(invocationCount = 3)
>     public void testTwo() throws ClientProtocolException, IOException {
>         HttpResponse response = httpclient.execute(new 
> HttpGet("http://yahoo.com";));
>         int status = response.getStatusLine().getStatusCode();
>         response.getEntity();
>         System.out.println(status);
>         count++;
>         System.out.println(count);
> 
>     }
> 
> Thanks,
> Jaikit
> ---------------------------------------------------------------------
> 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]

Reply via email to