arturobernalg commented on code in PR #502:
URL: 
https://github.com/apache/httpcomponents-client/pull/502#discussion_r1385636960


##########
httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/BasicHttpClientConnectionManager.java:
##########
@@ -357,7 +357,19 @@ ManagedHttpClientConnection getConnection(final HttpRoute 
route, final Object st
                 this.conn = this.connFactory.createConnection(null);
                 this.created = System.currentTimeMillis();
             } else {
-                this.conn.activate();
+                // Check if the existing connection is stale
+                if (this.conn.isStale()) {

Review Comment:
   Upon reviewing your comment, I realize that I overlooked the intentional 
design behind the validate method's frequency of execution I've committed a new 
potential fix this. I have now submitted a new commit that aims to rectify 
this. The updated code ensures that the connection being released is indeed the 
one that was detached from the `InternalConnectionEndpoint`. This should 
maintain the intended behavior while addressing the issue at hand.
   While I have conducted extensive testing to validate this fix, I must admit 
that connection management is not my primary area of expertise. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to