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

Teresa Tang commented on HTTPCLIENT-2329:
-----------------------------------------

[~olegk] Here is the [^TestBasicConnectionManager.java]file with an additional 
test called testConnectionReuse.

I have not found a way to show the underlying connection in 
BasicHttpClientConnectionManager through code, so to see the behavior I am 
describing, please add a breakpoint in the getConnection method of 
BasicHttpClientConnectionManager at line 253. 

What I am observing is that although I have set connectionReuseStrategy to 
never reuse, the connection object (this.conn) is the same object for all 3 
requests, and that for the 2nd and 3rd request, closed = "true". 

 

> BasicHttpClientConnectionManager reuses closed connection objects
> -----------------------------------------------------------------
>
>                 Key: HTTPCLIENT-2329
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2329
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>    Affects Versions: 5.3.1
>            Reporter: Teresa Tang
>            Priority: Major
>         Attachments: TestBasicConnectionManager.java
>
>
> In the discardEndpoint method of InternalExecRuntime.java, the endpoint and 
> connection are closed. The manager releases the connection with a timevalue 
> of 0 ms. Because 0 is not considered positive, this leads to the expiration 
> being set to Long.MAX_VALUE. Upon the next connection request, the manager 
> will continue to use this unexpired connection object, even though it is 
> closed. 
>  
> The intention of the 0 ms timevalue was to have the connection expire 
> immediately and then be discarded so that the manager will create a new 
> connection for the next request.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to