This is an automated email from the ASF dual-hosted git repository.

symat pushed a commit to branch branch-3.6
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/branch-3.6 by this push:
     new c97cf3f5b ZOOKEEPER-4551: Do not log spammy stacktrace when a client 
closes its connection
c97cf3f5b is described below

commit c97cf3f5bd8e136dc0fe268467f5793136199c68
Author: Enrico Olivelli <[email protected]>
AuthorDate: Wed Jun 1 17:33:57 2022 +0200

    ZOOKEEPER-4551: Do not log spammy stacktrace when a client closes its 
connection
    
    Motivation:
    See more here https://issues.apache.org/jira/browse/ZOOKEEPER-4551
    
    Modifications:
    Do not log the stacktrace, just write the message at INFO level
    
    Author: Enrico Olivelli <[email protected]>
    
    Reviewers: Mate Szalay-Beko <[email protected]>
    
    Closes #1889 from eolivelli/fix/remove-spam-stacktrace
    
    (cherry picked from commit 7a515fee0124eea389c599995915927e49cf4c57)
    Signed-off-by: Mate Szalay-Beko <[email protected]>
---
 .../main/java/org/apache/zookeeper/server/NIOServerCnxn.java   | 10 +++++++++-
 1 file changed, 9 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 9cde078d3..fcfac525c 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
@@ -323,7 +323,15 @@ public class NIOServerCnxn extends ServerCnxn {
             if (k.isReadable()) {
                 int rc = sock.read(incomingBuffer);
                 if (rc < 0) {
-                    handleFailedRead();
+                    try {
+                        handleFailedRead();
+                    } catch (EndOfStreamException e) {
+                        // no stacktrace. this case is very common, and it is 
usually not a problem.
+                        LOG.info("{}", e.getMessage());
+                        // expecting close to log session closure
+                        close(e.getReason());
+                        return;
+                    }
                 }
                 if (incomingBuffer.remaining() == 0) {
                     boolean isPayload;

Reply via email to