Skip to content

Commit

Permalink
[FLINK-5745] [network] Set uncaught exception handler for Netty threads
Browse files Browse the repository at this point in the history
This sets a JVM-terminating handler that logs errors from uncaught exceptions
and terminates the process so that critical exceptions are not accidentally
lost and leave the system running in an inconsistent state.

This closes apache#3293.
  • Loading branch information
Nico Kruber authored and uce committed Feb 15, 2017
1 parent b455f22 commit 9b4cd34
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.ssl.SslHandler;
import org.apache.flink.runtime.util.FatalExitExceptionHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -44,7 +45,10 @@

class NettyServer {

private static final ThreadFactoryBuilder THREAD_FACTORY_BUILDER = new ThreadFactoryBuilder().setDaemon(true);
private static final ThreadFactoryBuilder THREAD_FACTORY_BUILDER =
new ThreadFactoryBuilder()
.setDaemon(true)
.setUncaughtExceptionHandler(FatalExitExceptionHandler.INSTANCE);

private static final Logger LOG = LoggerFactory.getLogger(NettyServer.class);

Expand Down

0 comments on commit 9b4cd34

Please sign in to comment.