You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "rschmitt (via GitHub)" <gi...@apache.org> on 2025/07/04 04:33:06 UTC

[PR] Fix `validateAfterActivity` on the async client [httpcomponents-client]

rschmitt opened a new pull request, #667:
URL: https://github.com/apache/httpcomponents-client/pull/667

   `validateAfterActivity` is primarily a synchronous client feature, since it is necessary to attempt to read from the underlying socket in order to discover that the connection has been closed by the remote peer. The async client doesn't have this issue; the IOReactor is automatically notified when connections are closed and removes them from the pool (see `SingleCoreIOReactor::processClosedSessions`).
   
   For some reason, however, the async client's connection manager treats `validateAfterActivity` as a kind of connection TTL: if the connection has been idle longer than the `validateAfterActivity` config value, then the connection is closed immediately unless it is an HTTP/2 connection, in which case a PING frame is used to check for liveness. Since stale connections are removed from the pool automatically as mentioned above, this change simply removes this connection close behavior.
   
   A set of integration tests has been added to cover both clients.


-- 
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-unsubscribe@hc.apache.org

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


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


Re: [PR] Fix `validateAfterInactivity` on the async client [httpcomponents-client]

Posted by "rschmitt (via GitHub)" <gi...@apache.org>.
rschmitt merged PR #667:
URL: https://github.com/apache/httpcomponents-client/pull/667


-- 
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-unsubscribe@hc.apache.org

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


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


Re: [PR] Fix `validateAfterInactivity` on the async client [httpcomponents-client]

Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c commented on code in PR #667:
URL: https://github.com/apache/httpcomponents-client/pull/667#discussion_r2186982426


##########
httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java:
##########
@@ -315,10 +315,6 @@ public void completed(final PoolEntry<HttpRoute, ManagedAsyncClientConnection> p
                                             })), Command.Priority.IMMEDIATE);
                                             return;

Review Comment:
   @rschmitt My bad. Disregard.



-- 
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-unsubscribe@hc.apache.org

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


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


Re: [PR] Fix `validateAfterInactivity` on the async client [httpcomponents-client]

Posted by "rschmitt (via GitHub)" <gi...@apache.org>.
rschmitt commented on code in PR #667:
URL: https://github.com/apache/httpcomponents-client/pull/667#discussion_r2186902254


##########
httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java:
##########
@@ -315,10 +315,6 @@ public void completed(final PoolEntry<HttpRoute, ManagedAsyncClientConnection> p
                                             })), Command.Priority.IMMEDIATE);
                                             return;

Review Comment:
   Won't that cause `leaseCompleted(poolEntry)` to be called immediately (line 321) after the PingCommand is submitted, and then a second time after the PingCommand finishes?



-- 
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-unsubscribe@hc.apache.org

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


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


Re: [PR] Fix `validateAfterInactivity` on the async client [httpcomponents-client]

Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c commented on code in PR #667:
URL: https://github.com/apache/httpcomponents-client/pull/667#discussion_r2185688918


##########
httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java:
##########
@@ -315,10 +315,6 @@ public void completed(final PoolEntry<HttpRoute, ManagedAsyncClientConnection> p
                                             })), Command.Priority.IMMEDIATE);
                                             return;

Review Comment:
   @rschmitt I guess `return` here can also be removed. Looks good otherwise.



-- 
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-unsubscribe@hc.apache.org

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


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