From 4b27c62e866740c977837e52bd264c22afbe6376 Mon Sep 17 00:00:00 2001 From: Mathieu Marie Date: Fri, 26 Feb 2021 09:35:02 +0000 Subject: [PATCH] ZOOKEEPER-4221: Improve the error message when message goes above jute.maxbufer size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Author: Mathieu Marie Reviewers: Damien Diederen , Mate Szalay-Beko Closes #1614 from mariemat/ZOOKEEPER-4221 (cherry picked from commit 94d0c4d8558e1b201665bb9dffd33dacbc7ca945) Signed-off-by: Mate Szalay-Beko --- .../main/java/org/apache/zookeeper/server/NIOServerCnxn.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/server/NIOServerCnxn.java b/zookeeper-server/src/main/java/org/apache/zookeeper/server/NIOServerCnxn.java index 2e65da84044..02cde23a917 100644 --- a/zookeeper-server/src/main/java/org/apache/zookeeper/server/NIOServerCnxn.java +++ b/zookeeper-server/src/main/java/org/apache/zookeeper/server/NIOServerCnxn.java @@ -545,7 +545,10 @@ private boolean readLength(SelectionKey k) throws IOException { return false; } if (len < 0 || len > BinaryInputArchive.maxBuffer) { - throw new IOException("Len error " + len); + throw new IOException("Len error. " + + "A message from " + this.getRemoteSocketAddress() + " with advertised length of " + len + + " is either a malformed message or too large to process" + + " (length is greater than jute.maxbuffer=" + BinaryInputArchive.maxBuffer + ")"); } if (!isZKServerRunning()) { throw new IOException("ZooKeeperServer not running");