You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "junwen yang (Jira)" <ji...@apache.org> on 2021/05/05 21:05:00 UTC

[jira] [Commented] (CASSANDRA-16582) Groupby queries trigger ArrayIndexOutOfBoundsException on mixed version cluster

    [ https://issues.apache.org/jira/browse/CASSANDRA-16582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17339896#comment-17339896 ] 

junwen yang commented on CASSANDRA-16582:
-----------------------------------------

 Based on this, we found there are several other enums using orders to conduct serialization/deserialization, such as:
TraceType in cassandra/src/java/org/apache/cassandra/tracing/Tracing.java
Kind in cassandra/src/java/org/apache/cassandra/db/filter/ColumnSubselection.java. 

Current TraceType and Kind hasn't been changed for a while, but I believe a comments stating that "their order is used in serialization, and don't change it" will be helpful for further code practice. 


> Groupby queries trigger ArrayIndexOutOfBoundsException on mixed version cluster
> -------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-16582
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16582
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Messaging/Internode
>            Reporter: junwen yang
>            Assignee: Adam Holmberg
>            Priority: Normal
>             Fix For: 4.0, 4.0-rc1
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> When I have a mixed cluster with C*3.10 and C*4.0-beta4, issuing GROUP BY query to 3.10 will trigger `java.lang.ArrayIndexOutOfBoundsException`. 
> Reproduce:
> having a mixed cluster 3.10 and 4.0-beta4
>  
> {code:java}
> // create keyspace and db
> cqlsh> CREATE KEYSPACE test WITH replication = {'class':'SimpleStrategy', 'replication_factor' : 1};
> cqlsh> use test;
> cqlsh:test> create table login_log ( user_id int, application_name text, primary key (user_id, application_name) ) with clustering order by (application_name asc);
> cqlsh:test> insert into login_log (user_id, application_name) VALUES(1, 'bash');cqlsh:test> insert into login_log (user_id, application_name) VALUES(1, 'chrome');
> // issue GROUP BY QUERY
> cqlsh:test> select user_id, application_name from login_log group by user_id, application_name;{code}
>  
> The reason why the bug happens is that the Kind enum in DataLimits has changed from 6 values to 4 values: 
>  
> {code:java}
> [THRIFT_LIMIT, SUPER_COLUMN_COUNTING_LIMIT, CQL_GROUP_BY_LIMIT, CQL_GROUP_BY_PAGING_LIMIT]{code}
> {code:java}
> [CQL_LIMIT, CQL_PAGING_LIMIT, CQL_GROUP_BY_LIMIT, CQL_GROUP_BY_PAGING_LIMIT]    
> {code}
> Thus when node 3.10 forwards the read command with CQL_GROUP_BY_LIMIT to node 4.0, it tries to read the value of index 4 in Kind which has only 4 elements, causing ArrayIndexOutOfBoundsException
> Log details:
> {code:java}
> ERROR [Messaging-EventLoop-3-5] 2021-04-09 00:27:14,899 InboundMessageHandler.java:334 - /251.250.238.1:7000->/251.250.238.2:7000-LEGACY_MESSAGES-c356fde1 unexpected exception caught while deserializing a message
> java.lang.ArrayIndexOutOfBoundsException: 4
>         at org.apache.cassandra.db.filter.DataLimits$Serializer.deserialize(DataLimits.java:1172)
>         at org.apache.cassandra.db.ReadCommand$Serializer.deserialize(ReadCommand.java:1006)
>         at org.apache.cassandra.db.ReadCommand$Serializer.deserialize(ReadCommand.java:909)
>         at org.apache.cassandra.net.Message$Serializer.deserializePayloadPre40(Message.java:966)
>         at org.apache.cassandra.net.Message$Serializer.deserializePre40(Message.java:947)
>         at org.apache.cassandra.net.Message$Serializer.deserializePre40(Message.java:935)
>         at org.apache.cassandra.net.Message$Serializer.deserialize(Message.java:635)
>         at org.apache.cassandra.net.InboundMessageHandler.processSmallMessage(InboundMessageHandler.java:320)
>         at org.apache.cassandra.net.InboundMessageHandler.processOneContainedMessage(InboundMessageHandler.java:303)
>         at org.apache.cassandra.net.InboundMessageHandler.processFrameOfContainedMessages(InboundMessageHandler.java:270)
>         at org.apache.cassandra.net.InboundMessageHandler.processIntactFrame(InboundMessageHandler.java:255)
>         at org.apache.cassandra.net.InboundMessageHandler.process(InboundMessageHandler.java:246)
>         at org.apache.cassandra.net.FrameDecoder.deliver(FrameDecoder.java:320)
>         at org.apache.cassandra.net.FrameDecoder.channelRead(FrameDecoder.java:284)
>         at org.apache.cassandra.net.FrameDecoder.channelRead(FrameDecoder.java:268)
>         at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
>         at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
>         at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
>         at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
>         at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
>         at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
>         at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
>         at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:792)
>         at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe$1.run(AbstractEpollChannel.java:387)
>         at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
>         at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
>         at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:384)
>         at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
>         at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
>         at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>         at java.lang.Thread.run(Thread.java:748)`
> {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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