cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jasobr...@apache.org
Subject [02/10] cassandra git commit: Uncaught exceptions in Netty pipeline
Date Mon, 21 Aug 2017 22:43:31 GMT
Uncaught exceptions in Netty pipeline

patch by norman maurer; reviewed by jasobrown for CASSANDRA-13649


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

Branch: refs/heads/cassandra-3.0
Commit: e1aa7d32c95ff3f06de97803a186ff432237ecab
Parents: 9b6fd54
Author: Norman Maurer <norman_maurer@apple.com>
Authored: Fri Aug 18 10:32:39 2017 +0200
Committer: Jason Brown <jasedbrown@gmail.com>
Committed: Mon Aug 21 15:31:47 2017 -0700

----------------------------------------------------------------------
 CHANGES.txt                                          | 1 +
 src/java/org/apache/cassandra/transport/Message.java | 6 +++++-
 src/java/org/apache/cassandra/transport/Server.java  | 9 +++++++++
 3 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/e1aa7d32/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 5c1d1e5..2fbb7e9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.2.11
+ * Uncaught exceptions in Netty pipeline (CASSANDRA-13649)
  * Prevent integer overflow on exabyte filesystems (CASSANDRA-13067) 
  * Fix queries with LIMIT and filtering on clustering columns (CASSANDRA-11223)
  * Fix potential NPE when resume bootstrap fails (CASSANDRA-13272)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e1aa7d32/src/java/org/apache/cassandra/transport/Message.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/transport/Message.java b/src/java/org/apache/cassandra/transport/Message.java
index e4f5cac..2c2048f 100644
--- a/src/java/org/apache/cassandra/transport/Message.java
+++ b/src/java/org/apache/cassandra/transport/Message.java
@@ -540,10 +540,14 @@ public abstract class Message
             flusher.queued.add(item);
             flusher.start();
         }
+    }
+
+    @ChannelHandler.Sharable
+    public static final class ExceptionHandler extends ChannelInboundHandlerAdapter
+    {
 
         @Override
         public void exceptionCaught(final ChannelHandlerContext ctx, Throwable cause)
-        throws Exception
         {
             // Provide error message to client in case channel is still open
             UnexpectedChannelExceptionHandler handler = new UnexpectedChannelExceptionHandler(ctx.channel(),
false);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e1aa7d32/src/java/org/apache/cassandra/transport/Server.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/transport/Server.java b/src/java/org/apache/cassandra/transport/Server.java
index d1047f9..c91d37d 100644
--- a/src/java/org/apache/cassandra/transport/Server.java
+++ b/src/java/org/apache/cassandra/transport/Server.java
@@ -270,6 +270,7 @@ public class Server implements CassandraDaemon.Server
         private static final Frame.Decompressor frameDecompressor = new Frame.Decompressor();
         private static final Frame.Compressor frameCompressor = new Frame.Compressor();
         private static final Frame.Encoder frameEncoder = new Frame.Encoder();
+        private static final Message.ExceptionHandler exceptionHandler = new Message.ExceptionHandler();
         private static final Message.Dispatcher dispatcher = new Message.Dispatcher();
         private static final ConnectionLimitHandler connectionLimitHandler = new ConnectionLimitHandler();
 
@@ -303,6 +304,14 @@ public class Server implements CassandraDaemon.Server
             pipeline.addLast("messageDecoder", messageDecoder);
             pipeline.addLast("messageEncoder", messageEncoder);
 
+            // The exceptionHandler will take care of handling exceptionCaught(...) events
while still running
+            // on the same EventLoop as all previous added handlers in the pipeline. This
is important as the used
+            // eventExecutorGroup may not enforce strict ordering for channel events.
+            // As the exceptionHandler runs in the EventLoop as the previous handlers we
are sure all exceptions are
+            // correctly handled before the handler itself is removed.
+            // See https://issues.apache.org/jira/browse/CASSANDRA-13649
+            pipeline.addLast("exceptionHandler", exceptionHandler);
+
             pipeline.addLast(server.eventExecutorGroup, "executor", dispatcher);
         }
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message