Skip to content
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

Trigger NettyConnectionClosing#onClosing() on HTTP/2 channel-inactive #1560

Merged
merged 5 commits into from
May 16, 2021

Conversation

idelpivnitskiy
Copy link
Member

@idelpivnitskiy idelpivnitskiy commented May 13, 2021

Motivation:

onClosing() should be completed as soon as it's known that the connection is
going to close to notify LB and concurrency controller.

Modifications:

  • Complete onClosing when channelInactive or handlerRemoved event is
    propagated;
  • Do not complete onClosing on channelRead(Http2GoAwayFrame) because
    it will be completed inside KeepAliveManager.initiateGracefulClose;
  • Test that KeepAliveManager.initiateGracefulClose runs the Runnable;

Result:

NettyConnectionClosing#onClosing() is triggered for channelInactive and
handlerRemoved events.

Motivation:

`onClosing()` should be completed as soon as possible to notify LB and
concurrency controller that this connection is going to close soon.
`H2ParentConnectionContext` does not complete `onClosing` until user
closure is invoked on the event-loop (there is no need to wait for that)
and misses a few other pipeline events.

Modifications:

- Complete `onClosing` as soon as we `initiateGracefulClose`;
- Complete `onClosing` for the following pipeline events:
`channelInactive`, `handlerRemoved`, `SslCloseCompletionEvent`,
`ChannelInputShutdownReadComplete`, `ChannelOutputShutdownEvent` because
all of them indicate that the connection is going to close;

Result:

`NettyConnectionClosing#onClosing()` is triggered sooner for HTTP/2
connections.
@idelpivnitskiy idelpivnitskiy changed the title Improve NettyConnectionClosing#onClosing() for HTTP/2 Trigger NettyConnectionClosing#onClosing() earlier May 13, 2021
@idelpivnitskiy idelpivnitskiy changed the title Trigger NettyConnectionClosing#onClosing() earlier Trigger NettyConnectionClosing#onClosing() on HTTP/2 channel-inactive May 16, 2021
@idelpivnitskiy idelpivnitskiy merged commit 70e3368 into apple:main May 16, 2021
@idelpivnitskiy idelpivnitskiy deleted the onClosing branch May 16, 2021 03:44
hbelmiro pushed a commit to hbelmiro/servicetalk that referenced this pull request May 23, 2021
…ve (apple#1560)

Motivation:

`onClosing()` should be completed as soon as it's known that the connection is
going to close to notify LB and concurrency controller.

Modifications:

- Complete `onClosing` when `channelInactive` or `handlerRemoved` event is
propagated;
- Do not complete `onClosing` on `channelRead(Http2GoAwayFrame)` because
it will be completed inside `KeepAliveManager.initiateGracefulClose`;
- Test that `KeepAliveManager.initiateGracefulClose` runs the `Runnable`;

Result:

`NettyConnectionClosing#onClosing()` is triggered for `channelInactive` and
`handlerRemoved` events.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants