Skip to content

Add an optional idle timeout for downstream HTTP/2 connections#899

Open
acoshift wants to merge 1 commit into
cloudflare:mainfrom
acoshift:h2-downstream-idle-timeout
Open

Add an optional idle timeout for downstream HTTP/2 connections#899
acoshift wants to merge 1 commit into
cloudflare:mainfrom
acoshift:h2-downstream-idle-timeout

Conversation

@acoshift
Copy link
Copy Markdown

@acoshift acoshift commented Jun 1, 2026

The downstream H2 accept loop (accept_downstream_sessions) only ends when the client closes the connection, a codec error occurs, or the runtime graceful-shutdown ceiling fires. A client that completes the handshake and then sends no streams keeps the whole connection alive indefinitely.

Add an opt-in HttpServerOptions::h2_idle_timeout. When set, a connection that has accepted no new stream and has no request in flight for that duration is closed. In-flight streams are tracked via a StreamGuard handed to the per-session callback. The idle timer is re-armed each loop iteration, so any stream activity resets it; on fire with nothing in flight the loop returns, dropping the connection and closing the socket immediately.

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.

1 participant