Skip to content

HTTP/2 avoid closing connection when writing GOAWAY#9227

Merged
Scottmitch merged 1 commit intonetty:4.1from
Scottmitch:h2_goaway_no_close
Jun 7, 2019
Merged

HTTP/2 avoid closing connection when writing GOAWAY#9227
Scottmitch merged 1 commit intonetty:4.1from
Scottmitch:h2_goaway_no_close

Conversation

@Scottmitch
Copy link
Copy Markdown
Member

Motivation:
b4e3c12 introduced code to avoid coupling
close() to graceful close. It also added some code which attempted to infer when
a graceful close was being done in writing of a GOAWAY to preserve the
"connection is closed when all streams are closed behavior" for the child
channel API. However the implementation was too overzealous and may preemptively
close the connection if there are not currently any open streams (and close if
there are any frames which create streams in flight).

Modifications:

  • Decouple writing a GOAWAY from trying to infer if a graceful close is being
    done and closing the connection. Even if we could enhance this logic (e.g.
    wait to close until the second GOAWAY with no error) it is possible the user
    doesn't want the connection to be closed yet. We can add a means for the codec
    to orchestrate the graceful close in the future (e.g. write some special "close
    the connection when all streams are closed") but for now we can just let the
    application handle this.

Result:
Fixes #9207

@Scottmitch Scottmitch added this to the 4.1.37.Final milestone Jun 6, 2019
@Scottmitch Scottmitch self-assigned this Jun 6, 2019
Motivation:
b4e3c12 introduced code to avoid coupling
close() to graceful close. It also added some code which attempted to infer when
a graceful close was being done in writing of a GOAWAY to preserve the
"connection is closed when all streams are closed behavior" for the child
channel API. However the implementation was too overzealous and may preemptively
close the connection if there are not currently any open streams (and close if
there are any frames which create streams in flight).

Modifications:
- Decouple writing a GOAWAY from trying to infer if a graceful close is being
  done and closing the connection. Even if we could enhance this logic (e.g.
wait to close until the second GOAWAY with no error) it is possible the user
doesn't want the connection to be closed yet. We can add a means for the codec
to orchestrate the graceful close in the future (e.g. write some special "close
the connection when all streams are closed") but for now we can just let the
application handle this.

Result:
Fixes netty#9207
@Scottmitch Scottmitch changed the title f HTTP/2 avoid closing connection when writing GOAWAY Jun 6, 2019
@Scottmitch Scottmitch force-pushed the h2_goaway_no_close branch from 24c394d to 5afc095 Compare June 6, 2019 15:50
@normanmaurer
Copy link
Copy Markdown
Member

@netty-bot test this please

Copy link
Copy Markdown
Member

@carl-mastrangelo carl-mastrangelo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Scottmitch Scottmitch merged commit 643d521 into netty:4.1 Jun 7, 2019
@Scottmitch Scottmitch deleted the h2_goaway_no_close branch June 7, 2019 00:44
Scottmitch added a commit that referenced this pull request Jun 7, 2019
Motivation:
b4e3c12 introduced code to avoid coupling
close() to graceful close. It also added some code which attempted to infer when
a graceful close was being done in writing of a GOAWAY to preserve the
"connection is closed when all streams are closed behavior" for the child
channel API. However the implementation was too overzealous and may preemptively
close the connection if there are not currently any open streams (and close if
there are any frames which create streams in flight).

Modifications:
- Decouple writing a GOAWAY from trying to infer if a graceful close is being
  done and closing the connection. Even if we could enhance this logic (e.g.
wait to close until the second GOAWAY with no error) it is possible the user
doesn't want the connection to be closed yet. We can add a means for the codec
to orchestrate the graceful close in the future (e.g. write some special "close
the connection when all streams are closed") but for now we can just let the
application handle this.

Result:
Fixes #9207
@Scottmitch
Copy link
Copy Markdown
Member Author

master (e0bfc4f)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Http2ConnectionHandler#goAway should not initiate channel graceful shutdown

4 participants