Skip to content

http2: GOAWAY NO_ERROR is not an error, just end of connection#2375

Closed
bagder wants to merge 1 commit intomasterfrom
bagder/http2-goaway-cleanly
Closed

http2: GOAWAY NO_ERROR is not an error, just end of connection#2375
bagder wants to merge 1 commit intomasterfrom
bagder/http2-goaway-cleanly

Conversation

@bagder
Copy link
Member

@bagder bagder commented Mar 10, 2018

Reported-by: Łukasz Domeradzki
Fixes #2365

@jay
Copy link
Member

jay commented Mar 11, 2018

I'm not a fan of the commit title, it reads more like an explanation in a commit message. http2: mark the connection for close on GOAWAY is easier to understand. Also it's unclear to me if marking it for close can through some effect (?) prematurely terminate the connection and disrupt established streams. If I understand correctly server sent GOAWAY xx isn't necessarily the end it just means no more streams are being processed past whatever xx is, but <=xx may have yet to be served

@bagder
Copy link
Member Author

bagder commented Mar 11, 2018

I like your suggested commit message fix, I'll change.

Also it's unclear to me if marking it for close can through some effect (?) prematurely terminate the connection and disrupt established streams

Even if this fix isn't a 100% fix for GOAWAY, it still improves the situation since before this PR, libcurl treated the GOAWAY as an error and stopped. Now it "only" marks the connection for close, which is much more likely to be right.

I totally agree that it leaves a risk that if we have stream A and B going, and we receive a GOAWAY, we should still allow both streams to terminate before we close the connection and I believe the current setup might now close the connection once the next stream ends instead of allowing all existing streams to end.

It would be nice to be able to setup a test that does exactly that...

@bagder
Copy link
Member Author

bagder commented Mar 11, 2018

Hm, actually I think it should be fine. should_close_session should not return TRUE until both streams are done.

@jay jay added the HTTP/2 label Mar 11, 2018
@bagder
Copy link
Member Author

bagder commented Mar 11, 2018

should_close_session should not return TRUE until both streams are done.

No, that's not true either I think. It only returns false if there's data currently in the queues to "drain" for any stream. A complete fix will probably need to check if there's a non-closed stream still present on the connection before it allows it to get closed. It should still be marked for closure immediately on the receive of GOAWAY as it then makes sure the connection is not used further for new streams.

Assisted-by: Jay Satiro
Reported-by: Łukasz Domeradzki
Fixes #2365
@bagder bagder force-pushed the bagder/http2-goaway-cleanly branch from 9f9133f to ba0897f Compare March 11, 2018 11:35
@bagder
Copy link
Member Author

bagder commented Mar 11, 2018

We already had the check in multi_done, it just wasn't entirely correct since it would let bits.close override it, which seems wrong. I've forced-pushed an update now with that part addressed as well.

@bagder bagder closed this in 8b498a8 Mar 12, 2018
@bagder bagder deleted the bagder/http2-goaway-cleanly branch March 16, 2018 23:00
@lock lock bot locked as resolved and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Development

Successfully merging this pull request may close these issues.

2 participants