-
Notifications
You must be signed in to change notification settings - Fork 63
ignore ping frame when connection is closed #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
d4e74e9 to
33054ed
Compare
|
I'm definitely not a subject matter expert in HTTP2 but taking a dive into the specification, I think this is wrong.
I read this as - you must respond back to PING regardless of the situation and it should be at highest priority (e.g. it supersedes the GOAWAY frame). Is there a different or underlying fix that can be made to prevent those extra bytes or perhaps it is just the responsibility of the client to flush those? I think that after GOAWAY we can't just assume the connection is closed and done, we have to continue to do some house keeping until it's fully shut down. |
|
thx @mullermp ! I also read that section, and where I'm a bit on the fence here is on what to do when the receiver sees the frames in that particular order:
While we definitely have that issue at the frame emission level ( |
I think this is the fundamental problem. GOAWAY means to stop creating new streams. When the client receives GOAWAY, instead of shutting down the socket, the connection should be moved to a closing state. Then process the rest of the control frames (ping ack) then shut down the socket. Reading GOAWAY:
phrases such as "initiate shutdown" and "gracefully stop" and "administrative actions" I think indicate that we should not be immediately terminating the connection on that frame. |
while it's valid to process ping frames after sending/receiving goaway frames, preparing an AC frame may inadvertedly put bytes on the user buffer, thereby signaling that there's something to write back instead of terminating the connection
this causes the truffleruby build to fail, as it expects to either receive a ping ack or have the connection closed
33054ed to
071b575
Compare
|
(sorry for the late reply) @mullermp I think that that type of language refers solely to the HTTP/2 connection, not the client resources (i.e. socket) management. I'd even interpret "administrative actions" as taking down the socket. Nevertheless, I don't think that's the main issue at hand here, as at least, the way this surfaced in my case was that the issue was the ping ack frame being generated and buffered / ready to be sent back despite the goaway frame being received and the socket closed. While I've built the workaround to check for socket state before buffering the ping ack frame, I find it error prone to expect the client to do this (because it is most likely being overlooked everywhere), which is why I believe that
Number 2 seems to be more correct as per what you linked from the RFC. I just pushed a commit implementing it, lmk what you think. It opens the door to stream prioritization, an area where |
a418b38 to
2021920
Compare
the immediate benefit of eager-decoding frames is that one can push PING frames to the top of the stack, thereby prioritizing its processing.
2021920 to
e197bbb
Compare
while it's valid to process ping frames after sending/receiving goaway frames, preparing an AC frame may inadvertedly put bytes on the user buffer, thereby signaling that there's something to write back instead of terminating the connection,\
@igrigorik @mullermp would like to ask you guidance on this one. The RFC is not specific on what to do when receiving a PING frame after receiving a GOAWAY frame with stream id 0. I found at least one instance of a server which does exactly that, which led to some corruption on a long lived client connection, and while I can theoretically work around it on the client side in order to wipe out the buffer when processing a ping ack frame on a closed connection, that seems to be redundant and something the parser should do for me.