-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Log stacktraces of threads that failed to terminate on shutdown within timeout in ExecutorProvider #9840
Conversation
…n timeout in ExecutorProvider
@@ -71,7 +75,9 @@ public void shutdownNow() { | |||
executors.forEach(executor -> { | |||
executor.shutdownNow(); | |||
try { | |||
executor.awaitTermination(10, TimeUnit.SECONDS); | |||
if(!executor.awaitTermination(10, TimeUnit.SECONDS)) { | |||
log.error("Failed to terminate executor with pool name {} within timeout. The following are stack traces of still running threads.\n{}", poolName, getThreadDump()); |
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.
Maybe use log.warn here?
@@ -791,7 +791,7 @@ private static EventLoopGroup getEventLoopGroup(ClientConfigurationData conf) { | |||
return EventLoopUtil.newEventLoopGroup(conf.getNumIoThreads(), threadFactory); | |||
} | |||
|
|||
private static ThreadFactory getThreadFactory(String poolName) { | |||
public static ThreadFactory getThreadFactory(String poolName) { |
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.
Actually, it makes more sense to just move this static method over to the other class.
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.
changed not needed anymore
import static com.google.common.base.Preconditions.checkNotNull; | ||
import com.google.common.collect.Lists; | ||
import io.netty.util.concurrent.DefaultThreadFactory; | ||
import javafx.util.Pair; |
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.
Do not use javafx
import, rather commons.lang3.
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.
fixed
Motivation
Log stacktraces of threads that failed to terminate on shutdown within timeout in ExecutorProvider so that we have more insights on where threads are getting stuck especially for message listener threads that run user code.
Example of output when an executor failed to shutdown within timeout