[jira] [Commented] (HTTPCLIENT-1857) HttpClient falsely closes a reusable connection

2017-06-19 Thread Rodolfo Udo Labsch (JIRA)

[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-1857?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16055021#comment-16055021
 ] 

Rodolfo Udo Labsch commented on HTTPCLIENT-1857:


[~olegk],

Suppose we cut reading the InputStream in the middle, the following should 
happend:
- close the response object.
- The pool receives back the connection
- The pool checks if the inputstream was read all the way to the end
- if yes, throw away the not used buffer, i.e. read the stream all the way to 
the end but not using any bytes on it.

If after all of this the server stilll holds any state, we do have a defective 
server since HTTP should not work that way.
And like I said, the unused body should be ignored and thrown away, so that we 
may reuse the connection.
And once again, I do not know if it was implemented this way, but seems the 
most logical operating mode to me.

> 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: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org



[jira] [Comment Edited] (HTTPCLIENT-1857) HttpClient falsely closes a reusable connection

2017-06-19 Thread Rodolfo Udo Labsch (JIRA)

[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-1857?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16055021#comment-16055021
 ] 

Rodolfo Udo Labsch edited comment on HTTPCLIENT-1857 at 6/20/17 1:01 AM:
-

[~olegk],

Suppose we cut reading the InputStream in the middle, the following should 
happend:
- close the response object.
- The pool receives back the connection
- The pool checks if the inputstream was read all the way to the end
- if not, throw away the not used buffer, i.e. read the stream all the way to 
the end but not using any bytes on it.

If after all of this the server stilll holds any state, we do have a defective 
server since HTTP should not work that way.
And like I said, the unused body should be ignored and thrown away, so that we 
may reuse the connection.
And once again, I do not know if it was implemented this way, but seems the 
most logical operating mode to me.


was (Author: devilus):
[~olegk],

Suppose we cut reading the InputStream in the middle, the following should 
happend:
- close the response object.
- The pool receives back the connection
- The pool checks if the inputstream was read all the way to the end
- if yes, throw away the not used buffer, i.e. read the stream all the way to 
the end but not using any bytes on it.

If after all of this the server stilll holds any state, we do have a defective 
server since HTTP should not work that way.
And like I said, the unused body should be ignored and thrown away, so that we 
may reuse the connection.
And once again, I do not know if it was implemented this way, but seems the 
most logical operating mode to me.

> 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: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org



[jira] [Commented] (HTTPCLIENT-1857) HttpClient falsely closes a reusable connection

2017-06-18 Thread Rodolfo Udo Labsch (JIRA)

[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-1857?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16053353#comment-16053353
 ] 

Rodolfo Udo Labsch commented on HTTPCLIENT-1857:


Hello [~olegk],

If we are closing a response even after not consuming or partially consuming an 
entity, the content should actually be ignored but the connection should still 
be reusable, hence the connection should go back pristine to the pool.

I did not check the code if this is done, but that would be the most logical 
imo for a pooled Connection.

> 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: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org



[jira] [Comment Edited] (HTTPCLIENT-1857) HttpClient falsely closes a reusable connection

2017-06-18 Thread Rodolfo Udo Labsch (JIRA)

[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-1857?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16053353#comment-16053353
 ] 

Rodolfo Udo Labsch edited comment on HTTPCLIENT-1857 at 6/18/17 11:55 PM:
--

Hello [~olegk],

If we are closing a response even after not consuming or partially consuming an 
entity, the content should actually be ignored but the connection should still 
be reusable, hence the connection should go back pristine to the pool.

I did not check the code if this is done, but that would be the most logical 
imo for a pooled Connection.

What do you say [~olegk]?


was (Author: devilus):
Hello [~olegk],

If we are closing a response even after not consuming or partially consuming an 
entity, the content should actually be ignored but the connection should still 
be reusable, hence the connection should go back pristine to the pool.

I did not check the code if this is done, but that would be the most logical 
imo for a pooled Connection.

> 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: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org



[jira] [Created] (HTTPCLIENT-1857) HttpClient falsely closes a reusable connection

2017-06-17 Thread Rodolfo Udo Labsch (JIRA)
Rodolfo Udo Labsch created HTTPCLIENT-1857:
--

 Summary: 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: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org