Details
-
Bug
-
Status: Resolved
-
Low
-
Resolution: Fixed
-
None
-
Low
Description
In ErrorMessage.encode() and encodedSize(), we do not handle the exception having a null message. This can result in an error like the following:
ERROR [SharedPool-Worker-1] 2016-02-10 17:41:29,793 Message.java:611 - Unexpected exception during request; channel = [id: 0xc2c6499a, /127.0.0.1:53299 => /127.0.0.1:9042] java.lang.NullPointerException: null at org.apache.cassandra.db.TypeSizes.encodedUTF8Length(TypeSizes.java:46) ~[cassandra-all-3.0.3.874.jar:3.0.3.874] at org.apache.cassandra.transport.CBUtil.sizeOfString(CBUtil.java:132) ~[cassandra-all-3.0.3.874.jar:3.0.3.874] at org.apache.cassandra.transport.messages.ErrorMessage$1.encodedSize(ErrorMessage.java:215) ~[cassandra-all-3.0.3.874.jar:3.0.3.874] at org.apache.cassandra.transport.messages.ErrorMessage$1.encodedSize(ErrorMessage.java:44) ~[cassandra-all-3.0.3.874.jar:3.0.3.874] at org.apache.cassandra.transport.Message$ProtocolEncoder.encode(Message.java:328) ~[cassandra-all-3.0.3.874.jar:3.0.3.874] at org.apache.cassandra.transport.Message$ProtocolEncoder.encode(Message.java:314) ~[cassandra-all-3.0.3.874.jar:3.0.3.874] at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89) ~[netty-all-4.0.34.Final.jar:4.0.34.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:629) ~[netty-all-4.0.34.Final.jar:4.0.34.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:686) ~[netty-all-4.0.34.Final.jar:4.0.34.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:622) ~[netty-all-4.0.34.Final.jar:4.0.34.Final] at org.apache.cassandra.transport.Message$Dispatcher$Flusher.run(Message.java:445) ~[cassandra-all-3.0.3.874.jar:3.0.3.874] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:358) ~[netty-all-4.0.34.Final.jar:4.0.34.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) ~[netty-all-4.0.34.Final.jar:4.0.34.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) ~[netty-all-4.0.34.Final.jar:4.0.34.Final] at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) ~[netty-all-4.0.34.Final.jar:4.0.34.Final] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_71]