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, it's possible that the response has been
> drained, and the connection is still pooled awaiting reuse. In the
> response.getEntity().close() case, it's bypassing the response
> draining code-path, and closing the socket. Once the above commit has
> been released, both codepaths will produce the same behavior, and I
> suspect in your case neither will close sockets as they're meant to
> be reused later on. Connection reuse can be configured/disabled if
> you prefer, such that closing the response/entity/stream will close
> the socket in all cases.
> 
> -ck
> 

I strongly suspect that the connection was simply kept alive and
pooled. That can be established by tuning on connection management
context logging.

Oleg


> On Thu, Jul 7, 2022, at 13:58, Gordon Ross wrote:
> > 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 = response.getEntity().getContent();
> > is.close();
> > response.close();
> > 
> > But even with this, the underlying socket remains open.
> > 
> > I’ve tried looking at the samples and I can’t see I’m doing
> > anything different. What am I missing?
> > 
> > 
> > Gordon Ross (he/him)
> > Collaboration Tools Team
> > University Information Services
> > University of Cambridge
> > 
> > While it suits me to email outside normal working hours, I do not
> > expect a response outside your own.
> > 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org

Reply via email to