zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject zookeeper git commit: ZOOKEEPER-2809: Unnecessary stack-trace in server when the client dis…
Date Mon, 11 Sep 2017 22:07:58 GMT
Repository: zookeeper
Updated Branches:
  refs/heads/branch-3.4 cd5e6b263 -> 34665cd5b


ZOOKEEPER-2809: Unnecessary stack-trace in server when the client dis…

Unnecessary stack-trace in server when the client disconnects unexpectedly.

Backport from master, branch-3.5 to branch-3.4. Removes unnecessary stack traces from the
catch blocks of method doIO in NIOServerCnxn. For EndOfStreamException stack trace is replaced
with logging only the message and also contains the removal of stack traces for exceptions
CancelledKeyException and IOException as per commit 6206b495 referenced in the ticket.
This change is necessary as there are projects which consider all stack traces as bugs.
For CancelledKeyException and IOException developers are still able to see stack traces at
log level Debug.
This change is in sync with master and branch-3.5.

Author: Mark Fenes <mfenes@cloudera.com>

Reviewers: Abe Fine <afine@apache.org>, Michael Han <hanm@apache.org>

Closes #355 from mfenes/ZOOKEEPER-2809


Project: http://git-wip-us.apache.org/repos/asf/zookeeper/repo
Commit: http://git-wip-us.apache.org/repos/asf/zookeeper/commit/34665cd5
Tree: http://git-wip-us.apache.org/repos/asf/zookeeper/tree/34665cd5
Diff: http://git-wip-us.apache.org/repos/asf/zookeeper/diff/34665cd5

Branch: refs/heads/branch-3.4
Commit: 34665cd5bdbcb6aaeecb6b204028ef1ffab9f2d8
Parents: cd5e6b2
Author: Mark Fenes <mfenes@cloudera.com>
Authored: Mon Sep 11 15:07:55 2017 -0700
Committer: Michael Han <hanm@apache.org>
Committed: Mon Sep 11 15:07:55 2017 -0700

----------------------------------------------------------------------
 .../org/apache/zookeeper/server/NIOServerCnxn.java    | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zookeeper/blob/34665cd5/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java b/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
index 52d0626..f191129 100644
--- a/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
+++ b/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
@@ -363,9 +363,8 @@ public class NIOServerCnxn extends ServerCnxn {
                 }
             }
         } catch (CancelledKeyException e) {
-            LOG.warn("Exception causing close of session 0x"
-                    + Long.toHexString(sessionId)
-                    + " due to " + e);
+            LOG.warn("CancelledKeyException causing close of session 0x"
+                     + Long.toHexString(sessionId));
             if (LOG.isDebugEnabled()) {
                 LOG.debug("CancelledKeyException stack trace", e);
             }
@@ -374,14 +373,15 @@ public class NIOServerCnxn extends ServerCnxn {
             // expecting close to log session closure
             close();
         } catch (EndOfStreamException e) {
-            LOG.warn("caught end of stream exception",e); // tell user why
-
+            LOG.warn(e.getMessage());
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("EndOfStreamException stack trace", e);
+            }
             // expecting close to log session closure
             close();
         } catch (IOException e) {
             LOG.warn("Exception causing close of session 0x"
-                    + Long.toHexString(sessionId)
-                    + " due to " + e);
+                     + Long.toHexString(sessionId) + ": " + e.getMessage());
             if (LOG.isDebugEnabled()) {
                 LOG.debug("IOException stack trace", e);
             }


Mime
View raw message