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

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


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

commit a0cd35869708a219adc1515ca8d4ab7eb7f82a46
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 02cde23a9..dd62154fc 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
@@ -330,7 +330,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