Hi!
I am writing http2 client on c++ using libnghttp2 and test it with server written on python and use hyper-h2 for the server (hyper-h2 version is v3.1.1).
I've encountered an error when hyper-h2 generates StreamClosedError on receiving WINDOW_UPDATE for a stream that is in closed stated. This problem seems similar to https://github.com/python-hyper/hyper-h2/issues/1183 but it is not quite the same.
Short description of the timeline from client's point of view:
> Client initiates connection and makes request (stream_id = 1)
< Client receives response
> Client tries to do 3 requests simultaneously (streams_id = 3, 5, 7)
< Client receives part of the response for stream_id 3
> Client sends WINDOW_UPDATE for connection (stream_id = 0) and for stream_id = 3
< Client receives rest of the response for stream_id 3
< Client receives part of the response for stream_id 5
< Client receives GOAWAY
Short description of the timeline from server's point of view:
> Server accepts connection and receives request (stream_id = 1)
< Server replies to stream_id = 1 (stream_id = 1 is in closed state)
> Server receives request (stream_id = 3)
> Server receives request (stream_id = 5)
< Server sends first part of the reply for stream_id = 3
< Server sends rest of the reply for stream_id = 3 (stream_id == 3 is now in 'closed' state)
< Server sends first part of reply (stream_id = 5) (window is to small to send all data)
> Server receives request (stream_id = 7) (at this point closed stream with id == 3 is moved from container that holds streams to '_closed_streams' container)
> Server receives WINDOW_UPDATE for connection (stream_id == 0)
> Server receives WINDOW_UPDATE for connection (stream_id == 3). At this point '_get_stream_by_id' fails because it can't find stream with id == 3 (this stream is now in container 'Connection._closed_streams' of the connection) and StreamClosedError is generated.
< Server sends GOAWAY and closes connection
So the main problem is that stream with id == 3 is closed by h2. Then after receiving another request this closed stream is moved to Connection._closed_streams. And when WINDOW_UPDATE for id == 3 arrives, hyper-h2 cannot find stream with such id.
Here are more detailed logs of the server (Logs from hyper-h2 code itself have tag [hyper-h2]. Also I logged states of Connection._closed_streams and Connection.streams when an error occurred):
Hi! I am writing http2 client on c++ using
libnghttp2
and test it with server written on python and use hyper-h2 for the server (hyper-h2 version isv3.1.1
).I've encountered an error when hyper-h2 generates
StreamClosedError
on receivingWINDOW_UPDATE
for a stream that is in closed stated. This problem seems similar to https://github.com/python-hyper/hyper-h2/issues/1183 but it is not quite the same.Short description of the timeline from client's point of view:
Short description of the timeline from server's point of view:
So the main problem is that stream with id == 3 is closed by
h2
. Then after receiving another request this closed stream is moved toConnection._closed_streams
. And when WINDOW_UPDATE for id == 3 arrives, hyper-h2 cannot find stream with such id.Here are more detailed logs of the server (Logs from
hyper-h2
code itself have tag [hyper-h2]. Also I logged states ofConnection._closed_streams
andConnection.streams
when an error occurred):And here logs of the client:
If more detailed logs for client or server are needed I can provide them.