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

Make sure promise finishes during graceful shutdowns #1803

Merged
merged 2 commits into from
Aug 20, 2024

Conversation

jguerra
Copy link
Contributor

@jguerra jguerra commented Aug 19, 2024

The graceful close promise will not finish if some channels error out while closing. Make sure to finish the promise even if some channels have errors during closing

@@ -113,7 +113,14 @@ Promise<Void> gracefullyShutdownClientChannels(boolean forceCloseAfterTimeout) {
ScheduledFuture<?> timeoutTask = executor.schedule(
() -> {
LOG.warn("Force closing remaining {} active client channels.", channels.size());
channels.close();
channels.close().addListener(future -> {
Copy link
Collaborator

@argha-c argha-c Aug 19, 2024

Choose a reason for hiding this comment

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

This shouldn't be necessary.

The graceful close promise will not finish if some channels error out while closing.

This sounds incorrect. The closeFuture should be invoked even if certain channels error out on close(). It has the listener wired to set a success on the Promise. Where do you see this not being set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was behavior I suspected while validating our signal handling, but then also verified with a unit test. If one of the handlers in the group throws during close() handling then the closeFuture is not completed, and the channel remains in the group

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's really odd. Anyway, this doesn't hurt 🚢

@jguerra jguerra merged commit eb486af into master Aug 20, 2024
5 checks passed
argha-c pushed a commit that referenced this pull request Sep 10, 2024
* During graceful shutdowns make sure to still finish promise even if some channels fail to close

* Fix import order
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