Skip to content

Commit 5869a74

Browse files
committed
Maybe die before trying to log cause
This commit reorders a maybe die check and a logging statement for the following reasons: - we should die as quickly as possible if the cause is fatal - we do not want the JVM to be so broken that when we try to log another exception is thrown (maybe another out of memory exception) and then the maybe die is never invoked - maybe die will log the cause anyway if the cause is fatal so we only need to log if the cause is not fatal
1 parent 1084c7b commit 5869a74

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/transport-netty4/src/main/java/org/elasticsearch/transport/netty4/Netty4Transport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ protected void sendMessage(Channel channel, BytesReference reference, ActionList
321321
listener.onResponse(channel);
322322
} else {
323323
final Throwable cause = f.cause();
324-
logger.error("write and flush on the network layer failed", cause);
325324
Netty4Utils.maybeDie(cause);
325+
logger.error("write and flush on the network layer failed", cause);
326326
assert cause instanceof Exception;
327327
listener.onFailure((Exception) cause);
328328
}

0 commit comments

Comments
 (0)