From 158ab2e72470ae4d6fa6d0df9dd50b8a4bbdba2a Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Mon, 21 Nov 2016 22:13:19 -0500 Subject: [PATCH] Die with dignity on the network layer When a fatal error is thrown on the network layer, such an error never makes its way to the uncaught exception handler. This prevents the node from being torn down if an out of memory error or other fatal error is thrown while handling HTTP or transport traffic. This commit adds logic to ensure that such errors bubble their way up to the uncaught exception handler, even though Netty tries really hard to swallow everything. Original commit: elastic/x-pack-elasticsearch@f76757674f4bcab55fe64870b775b9dba0769211 --- .../transport/netty4/SecurityNetty4HttpServerTransport.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/security/transport/netty4/SecurityNetty4HttpServerTransport.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/security/transport/netty4/SecurityNetty4HttpServerTransport.java index 8bb25bbea71..13d3b9af2c7 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/security/transport/netty4/SecurityNetty4HttpServerTransport.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/security/transport/netty4/SecurityNetty4HttpServerTransport.java @@ -16,6 +16,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.http.netty4.Netty4HttpServerTransport; import org.elasticsearch.threadpool.ThreadPool; +import org.elasticsearch.transport.netty4.Netty4Utils; import org.elasticsearch.xpack.ssl.SSLService; import org.elasticsearch.xpack.security.transport.filter.IPFilter; @@ -42,6 +43,7 @@ public class SecurityNetty4HttpServerTransport extends Netty4HttpServerTransport @Override protected void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { + Netty4Utils.maybeDie(cause); if (!lifecycle.started()) { return; }