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

shutdown: manage connections before shutting down executors #501

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yaauie
Copy link
Contributor

@yaauie yaauie commented Aug 13, 2024

The previous implementation of shutdown relied on the shutdown of the top-level worker group causing the bound channel to not be able to execute any events, which effectively prevented the bound channel from receiving any more connections. It didn't actually close the channel

This had a side effect of causing existing connections to crash noisily as one or more handlers in the pipeline relied on the top-level executor group and submitted work to a closed executor. I believe it also had a side-effect of crashing the bound channel, which is how it stops listening.

By closing the connections first (in a reasonable order, server first), we can ensure that the connections are closed and that their channel pipelines will not submit work to executors that will reject them.

This change applies the guidance from netty docs "Simplify shutdown process with ChannelGroup".


Perhaps worth noting, the Server here has non-threadsafe code in Server#listen to support reuse of the plugin shutdown if it is already running. I don't believe that this code is accessible, nor that it would reliably work reliably due to the lack of threadsafety, but have not made pairwise changes to that unusual shutdown sequence.

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

Successfully merging this pull request may close these issues.

2 participants