From f79842be6f34126bee47f61a6eb048dd814c4344 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Sat, 30 Sep 2017 18:52:54 -0400 Subject: [PATCH] Die if write listener fails due to fatal error This commit performs a maybe die check after a write listener fails. --- .../transport/netty4/Netty4Transport.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/transport-netty4/src/main/java/org/elasticsearch/transport/netty4/Netty4Transport.java b/modules/transport-netty4/src/main/java/org/elasticsearch/transport/netty4/Netty4Transport.java index 577038a54a0..9cc75a08ee2 100644 --- a/modules/transport-netty4/src/main/java/org/elasticsearch/transport/netty4/Netty4Transport.java +++ b/modules/transport-netty4/src/main/java/org/elasticsearch/transport/netty4/Netty4Transport.java @@ -320,12 +320,10 @@ public class Netty4Transport extends TcpTransport { if (f.isSuccess()) { listener.onResponse(channel); } else { - Throwable cause = f.cause(); - // If the Throwable is an Error something has gone very wrong and Netty4MessageChannelHandler is - // going to cause that to bubble up and kill the process. - if (cause instanceof Exception) { - listener.onFailure((Exception) cause); - } + final Throwable cause = f.cause(); + Netty4Utils.maybeDie(cause); + assert cause instanceof Exception; + listener.onFailure((Exception) cause); } }); }