http2 icon indicating copy to clipboard operation
http2 copied to clipboard

GOAWAY shouldn't immediately close the connection

Open akshaymankar opened this issue 7 months ago • 1 comments

From Section about GOAWAY in the spec:

The GOAWAY frame (type=0x07) is used to initiate shutdown of a connection or to signal serious error conditions. GOAWAY allows an endpoint to gracefully stop accepting new streams while still finishing processing of previously established streams. This enables administrative actions, like server maintenance.

There is an inherent race condition between an endpoint starting new streams and the remote peer sending a GOAWAY frame. To deal with this case, the GOAWAY contains the stream identifier of the last peer-initiated stream that was or might be processed on the sending endpoint in this connection. For instance, if the server sends a GOAWAY frame, the identified stream is the highest-numbered stream initiated by the client.

Here the Receiver just throws an exception when it receives a GOAWAY and so the response can never be recieved:

https://github.com/kazu-yamamoto/http2/blob/07af719d98da6edb30ef818a93b5fce15368329b/Network/HTTP2/H2/Receiver.hs#L335-L339

akshaymankar avatar Dec 18 '23 23:12 akshaymankar