[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpclient-users
Subject:    Re: How to debug a hang during POST
From:       Tim Dudgeon <tdudgeon.ml () gmail ! com>
Date:       2016-05-25 16:37:04
Message-ID: b2a8700a-a41e-d9dd-dce1-5485017b232b () gmail ! com
[Download RAW message or body]


On 25/05/2016 13:54, Oleg Kalnichevski wrote:

> Tim,
>
> Please post wire / context log of the session.
>
> Oleg
>
>
I found the issue eventually. It was due a leaking connection 
(InputStream not being closed).
The problem was masked by no timeout being applied to getting a 
connection so it hung forever.
Setting that helped track down the problem. I then created a custom 
PoolingHttpClientConnectionManager that I could them inspect to find out 
where the leaking connections were happening. My intialisation now looks 
like this:

RequestConfig requestConfig = RequestConfig.custom()
         .setConnectionRequestTimeout(4000)
         .setConnectTimeout(4000)
         .setSocketTimeout(4000).build();

connectionManager =new PoolingHttpClientConnectionManager();connectionManager.setDefaultMaxPerRoute(10);

httpclient = HttpClients.custom()
         .setConnectionManager(connectionManager)
         .setDefaultRequestConfig(requestConfig).build();

Tim


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic