Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scylla node crashes upon prepare request with multi-column IN restriction #3692

Closed
eliransin opened this issue Aug 14, 2018 · 3 comments

Comments

@eliransin
Copy link
Contributor

commented Aug 14, 2018

Installation details
Scylla version (or git commit hash): 183d5ba
Cluster size: 1
OS (RHEL/CentOS/Ubuntu/AWS AMI):Fedora

When preparing a select statement with a multi-column in restriction, the node crashes.
The specific prepared statement that crashed the node: SELECT a FROM t WHERE (b,c) IN ?

A coredump is at UUID: cac8abf1-96e9-47e9-9f86-8e3768ccbdab

Testcase:

CREATE KEYSPACE blues WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};
use blues;
CREATE TABLE t (a text, b text,c text, PRIMARY KEY (a, b,c));
INSERT INTO t (a, b, c) values ('A2', 'A','B');
INSERT INTO t (a, b, c) values ('A3', 'C','D');
INSERT INTO t (a, b, c) values ('A3', 'D','E');

Then prepare the above select statement using any client.
This happened using a python driver with the following python script:

from cassandra.cluster import Cluster

cluster = Cluster()

session = cluster.connect('blues');
pstatement = session.prepare("SELECT a FROM t WHERE (b,c) IN ?")

also happened using unitest framework: e.prepare("select r1 from tir2 where (c1,r1) in ?;");
Attached also the parsed bt from the crash.
backtrace.txt

@tzach tzach added the bug label Aug 14, 2018

@duarten duarten added the CQL label Aug 14, 2018

@tzach

This comment has been minimized.

Copy link
Contributor

commented Aug 15, 2018

@eliransin @duarten is this even suppose to work?
My understanding of the CQL spec is IN is limited to one column.
(clearly, the server should not crash)

@eliransin

This comment has been minimized.

Copy link
Contributor Author

commented Aug 15, 2018

The In statement is limited to one column only on partition keys.
It can have multi column on clustering keys (which is kind of make sense).
The C* CQL syntax spec iin the clustering filters section states this as one of its options:
|( column_name , column_name [, column_name ] . . . ) IN term-tuple [,term-tuple] . . . )
I also failed to state in the issue that the same query with explicit IN clause woks.
For example:
SELECT a FROM t WHERE (b,c) IN (('A','B'),('D','E'))
returns:

 a
----
 A2
 A3
@eliransin

This comment has been minimized.

Copy link
Contributor Author

commented Aug 26, 2018

Just noticed this is a duplicate of duplicate of #3204

@slivne slivne added the duplicate label Sep 2, 2018

@slivne slivne added this to the 2.4 milestone Sep 2, 2018

pdziepak added a commit that referenced this issue Mar 7, 2019

cql3 : fix a crash upon preparing select with an IN restriction due t…
…o memory violation

When preparing a select query with a multicolumn in restriction, the
node crashed due to using a parameter after using a move on it.

Tests:
1. UnitTests (release)
2. Preparing a select statement that crashed the system before,
and verify it is not crashing.

Fixes #3204
Fixes #3692

Signed-off-by: Eliran Sinvani <eliransin@scylladb.com>
Message-Id: <7ebd210cd714a460ee5557ac612da970cee03270.1537947897.git.eliransin@scylladb.com>
(cherry picked from commit 22ad543)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.