[
https://issues.apache.org/jira/browse/HTTPCLIENT-1857?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Oleg Kalnichevski resolved HTTPCLIENT-1857.
-------------------------------------------
Resolution: Invalid
bq. The pool checks if the inputstream was read all the way to the end
The connection pool is unaware (and should not be aware) of message
delineation. This is a job of a protocol handler.
HttpClient has multiple connection release triggers. {{CloseableHttpResponse}}
is the last trigger that gets activated only if in case of an exception or in
case of a partial response consumption. In the normal course of response
processing the prorocol handler wraps the response {{InputStream}} with a proxy
that triggers release of the underlying connection gets released once the end
of message stream has been reached. In that case
{{CloseableHttpResponse#close}} essentially has no effect.
Oleg
> HttpClient falsely closes a reusable connection
> -----------------------------------------------
>
> Key: HTTPCLIENT-1857
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1857
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Reporter: Rodolfo Udo Labsch
> Attachments: ConnectionHolder.patch
>
>
> If you create a code with a reusable httpclient and then call execute as in
> the example with the following code. The http connection will be falsely
> closed.
> {code:java}
> private PoolingHttpClientConnectionManager connectionManager = new
> PoolingHttpClientConnectionManager();
> httpClient = HttpClients.custom()
> .setConnectionManager(connectionManager)
> .build();
> try (CloseableHttpResponse response = httpClient.execute(new
> HttpGet(enetLink), context)) {
> .....
> }
> {code}
> The reason being that we have:
> {code:java}
> CloseableHttpResponse:
> public void close() throws IOException {
> if (this.connHolder != null) {
> this.connHolder.close();
> }
> }
> ConnectionHolder:
> public void close() throws IOException {
> releaseConnection(false);
> }
> {code}
> Just created the correction, which is attached as patch.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]