hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Dudgeon <tdudgeon...@gmail.com>
Subject Re: How to debug a hang during POST
Date Wed, 25 May 2016 16:37:04 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message