Re: Sockets not closing

2022-07-07 Thread Shawn Heisey
On 7/7/22 11:58, Gordon Ross wrote: I’ve tried doing the bare minimum of: InputStream is = response.getEntity().getContent(); is.close(); response.close(); I remember having some problems with connections staying open, leading the client to run out.  I was advised to make sure the entity is

Re: Sockets not closing

2022-07-07 Thread Gordon Ross
How do I do that? Gordon. From: Oleg Kalnichevski Date: Thursday, 7 July 2022 at 19:30 To: HttpClient User Discussion Subject: Re: Sockets not closing On Thu, 2022-07-07 at 18:17 +, Gordon Ross wrote: > If I don’t do the getContent() then the socket is closed as soon as I > do

Re: Sockets not closing

2022-07-07 Thread Oleg Kalnichevski
On Thu, 2022-07-07 at 18:17 +, Gordon Ross wrote: > If I don’t do the getContent() then the socket is closed as soon as I > do response.close(). This is expected and per design. HttpClient has no choice but to close the connection assuming it may be left in a inconsistent state (there are

Re: Sockets not closing

2022-07-07 Thread Gordon Ross
If I don’t do the getContent() then the socket is closed as soon as I do response.close(). If I do getContent(), the socket stays open for several minutes (in ESTABLISHED state) and then the socket sits in CLOSE_WAIT for hours/days. Eventually I can’t open any more connections and I have to

Re: Sockets not closing

2022-07-07 Thread Oleg Kalnichevski
On Thu, 2022-07-07 at 14:10 -0400, Carter Kozak wrote: > Hi, > > I think you may be seeing the same issue as > https://issues.apache.org/jira/browse/HTTPCLIENT-2221, although in a > slightly different way. > https://github.com/apache/httpcomponents-client/pull/371 > > If the socket isn't closed,

Re: Sockets not closing

2022-07-07 Thread Carter Kozak
Hi, I think you may be seeing the same issue as https://issues.apache.org/jira/browse/HTTPCLIENT-2221, although in a slightly different way. https://github.com/apache/httpcomponents-client/pull/371 If the socket isn't closed, it's possible that the response has been drained, and the

Sockets not closing

2022-07-07 Thread Gordon Ross
I’m using HttpClient 5.1.3 and I’m having problems with the underlying socket not closing. This problem only occurs if I call response.getEntity().getContent() If I only call response.getEntity() the underlying socket gets closed fine. I’ve tried doing the bare minimum of: InputStream is =