Skip to content

Conversation

@rschmitt
Copy link
Contributor

@rschmitt rschmitt commented Jul 4, 2025

validateAfterInactivity 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 validateAfterInactivity as a kind of connection TTL: if the connection has been idle longer than the validateAfterInactivity 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.

@rschmitt rschmitt force-pushed the stale branch 4 times, most recently from 1d6abbc to 6387ff4 Compare July 4, 2025 04:54
@rschmitt rschmitt changed the title Fix validateAfterActivity on the async client Fix validateAfterInactivity on the async client Jul 4, 2025
`validateAfterInactivity` 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
`validateAfterInactivity` as a kind of connection TTL: if the connection
has been idle longer than the `validateAfterInactivity` 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.
@rschmitt rschmitt merged commit be41f5c into apache:master Jul 5, 2025
10 checks passed
@rschmitt rschmitt deleted the stale branch July 5, 2025 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants