hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From S├ębastien HEUZE <heuze....@gmail.com>
Subject ConnectionShutdownException and connection leak
Date Mon, 04 Jul 2016 15:45:30 GMT

We are encountering a little problem with our production server that use
RestTemplate, DefaultHttpClient,
HttpComponentsClientHttpRequestFactory, ThreadSafeClientConnManager and SSL

The server send (same route) approx 300k requests a day (1s timeout),
everything is fine except that we have connexion leak.
We tried setting a keepalive, setting a eviction thread, setting Pool ttl
but none of these worked.
And later we found the problem, each time the ConnectionShutdownException
is thrown, we have a connection  leak.
So in a week, our connection pool is filled and we need a server restart.

We have tested with a limited number of threads (50 during a limited time)
so we know how many open connection we have.
First it start with 50 connections, and each time we have an Exception we
have 1 connection leak.

So I tried to find a solution and I got one
Calling abortConnection in ConnectionShutdownException catch in
DefaultRequestDIrector class

It don't solve the unexpected ConnectionShutdown but it avoid connection

Do you have a better Idea to fix the solution ? (we can't upgrade our
HttpClient to 4.3 since it will require to upgrade spring version)


Spring Framework 3.1.4.RELEASE
Httpclient 4.1.4  (Tried dwith 4.1.1 (original) and 4.1.4)
Seems to be almost the same than this one :

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