Skip to content

Conversation

@arturobernalg
Copy link
Member

This introduces an HTTP/2 keep-alive PING policy for long-lived idle connections. When enabled, the client sends PING frames once the SETTINGS handshake is complete and no streams are active, and fails the session if the peer does not respond with PING[ACK] within the configured timeout. Integration tests validate that the connection remains usable past idle with keep-alive enabled and closes on inactivity when disabled.

@arturobernalg arturobernalg requested a review from ok2c January 25, 2026 18:38
@ok2c
Copy link
Member

ok2c commented Jan 25, 2026

@arturobernalg The change-set will likely need some work, but I am conceptually fine with it. @rschmitt Would you have any conceptual objections to the idea?

Emit PINGs on otherwise idle connections once SETTINGS are ACKed,
and close the session if the peer does not ACK within the configured timeout.
@rschmitt
Copy link
Contributor

When enabled, the client sends PING frames once the SETTINGS handshake is complete and no streams are active, and fails the session if the peer does not respond with PING[ACK] within the configured timeout.

This sounds way better than the current HTTP/2 implementation of setValidateAfterInactivity, which adds an entire round trip's worth of latency to the request path. Would it be outrageous if exposed this through setValidateAfterInactivity instead of adding something like a new H2Config option?

@ok2c
Copy link
Member

ok2c commented Jan 29, 2026

@arturobernalg

  1. I also think H2Config is not the right place. Keep it as a separate constructor parameter. Once available in client H2PingPolicy should go into ConnectionConfig
  2. Any chance you could use the existing ping command here?

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.

3 participants