Skip to content

Implement two-phase graceful HTTP/2 shutdown#654

Open
arturobernalg wants to merge 1 commit intoapache:masterfrom
arturobernalg:two-phase
Open

Implement two-phase graceful HTTP/2 shutdown#654
arturobernalg wants to merge 1 commit intoapache:masterfrom
arturobernalg:two-phase

Conversation

@arturobernalg
Copy link
Member

This change implements two-phase graceful shutdown for HTTP/2 connections.
The multiplexer sends an initial GOAWAY, waits one RTT using PING, then sends the final GOAWAY with the last processed stream identifier while continuing to handle in-flight peer streams and peer GOAWAY boundaries correctly.

Send an initial GOAWAY, wait one RTT using PING, then send the final GOAWAY with the last processed stream id.
@arturobernalg arturobernalg requested a review from ok2c March 18, 2026 06:06
@ok2c
Copy link
Member

ok2c commented Mar 19, 2026

@arturobernalg Why is this needed? What does this improve excactly?

@arturobernalg
Copy link
Member Author

Why is this needed? What does this improve excactly?

@ok2c
RFC 9113 recommends two-phase graceful shutdown for HTTP/2: initial GOAWAY with 2^31-1, wait one RTT, then final GOAWAY with the actual last processed stream id. This improves correctness of connection draining by avoiding shutdown races around in-flight stream creation and by preserving an accurate final GOAWAY boundary.

https://www.rfc-editor.org/rfc/rfc9113.html#section-6.8

“A server that is attempting to gracefully shut down a connection SHOULD send an initial GOAWAY frame with the last stream identifier set to 2^31-1 and a NO_ERROR code.”

“After allowing time for any in-flight stream creation (at least one round-trip time), the server MAY send another GOAWAY frame with an updated last stream identifier.”

@ok2c
Copy link
Member

ok2c commented Mar 19, 2026

A server that is attempting

@arturobernalg Very well. A server. And what about clients? Does this make any sense for client connections?

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