Skip to content

Commit

Permalink
Fix potential NPEin Netty4Transport.stopInternal (#56080)
Browse files Browse the repository at this point in the history
Closes #56069
  • Loading branch information
original-brownbear authored May 4, 2020
1 parent 134c0e8 commit b3f4835
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,15 +307,14 @@ protected Netty4TcpServerChannel bind(String name, InetSocketAddress address) {
@SuppressForbidden(reason = "debug")
protected void stopInternal() {
Releasables.close(() -> {
Future<?> shutdownFuture = eventLoopGroup.shutdownGracefully(0, 5, TimeUnit.SECONDS);
shutdownFuture.awaitUninterruptibly();
if (shutdownFuture.isSuccess() == false) {
logger.warn("Error closing netty event loop group", shutdownFuture.cause());
if (eventLoopGroup != null) {
Future<?> shutdownFuture = eventLoopGroup.shutdownGracefully(0, 5, TimeUnit.SECONDS);
shutdownFuture.awaitUninterruptibly();
if (shutdownFuture.isSuccess() == false) {
logger.warn("Error closing netty event loop group", shutdownFuture.cause());
}
}

serverBootstraps.clear();
clientBootstrap = null;
});
}, serverBootstraps::clear, () -> clientBootstrap = null);
}

protected class ClientChannelInitializer extends ChannelInitializer<Channel> {
Expand Down

0 comments on commit b3f4835

Please sign in to comment.