-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Replace PromiseCombiner usage on ClientConnectionsShutdown #1487
Conversation
|
||
//racy situation if new connections are still coming in, but any channels created after newCloseFuture will | ||
//be closed during the force close stage | ||
ChannelGroupFuture closeFuture = channels.newCloseFuture(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much cleaner!
} | ||
}); | ||
// Wait for all the attempts to close connections gracefully, or max of 30 secs | ||
if(closeFuture.await(30, TimeUnit.SECONDS)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, this would end up waiting a max of 30s
for shutdown across all channels. While it's an improvement, I think it's a change from the existing behavior which waits significantly longer.
Can we make this configurable as we roll this out?
…onto jvm shutdown hook thread. Make force close timeout configurable
closeFuture.addListener(future -> { | ||
if (!timeoutTask.isDone()) { | ||
//close happened before the timeout | ||
LOG.info("All connections closed within timeout"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: do we care? 😉
ClientConnectionsShutdown is broken in two different ways
gracefullyShutdownClientChannels()
is called as part of a discovery callback, the use ofImmediateEventExecutor.INSTANCE
triggers a deadlock check in netty:I replaced the use of PromiseCombiner with bulk operations on the ChannelGroup, and also added unit tests