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

query sql crash #5259

Closed
wanpengfei-git opened this issue Apr 19, 2022 · 1 comment · Fixed by #5345
Closed

query sql crash #5259

wanpengfei-git opened this issue Apr 19, 2022 · 1 comment · Fixed by #5345
Assignees
Labels
sqlancer type/bug Something isn't working
Milestone

Comments

@wanpengfei-git
Copy link
Collaborator

wanpengfei-git commented Apr 19, 2022

Steps to reproduce the behavior (Required)

DROP DATABASE IF EXISTS g2;
CREATE DATABASE g2;
USE g2;
admin set frontend config ("enable_decimal_v3" = "true");
CREATE TABLE t0 (c_0_0 DATETIME NOT NULL ,c_0_1 CHAR(1) NULL ,c_0_2 BIGINT NOT NULL ,c_0_3 DECIMAL(32, 10)  NULL ,c_0_4 CHAR(11) NULL ,c_0_5 JSON NOT NULL ,c_0_6 DECIMAL(8, 1)  NOT NULL ,c_0_7 VARCHAR(11) NULL ,c_0_8 ARRAY<INT> NULL ,c_0_9 JSON NOT NULL ) DUPLICATE KEY (c_0_0,c_0_1,c_0_2,c_0_3) PARTITION BY RANGE(c_0_0) (START ("2010-01-01") END ("2021-12-31") EVERY (INTERVAL 243 day)) DISTRIBUTED BY HASH (c_0_0) BUCKETS 3 properties("replication_num"="3") ;
CREATE TABLE t1 (c_1_0 VARCHAR(21) NOT NULL,c_1_1 VARCHAR(1) NOT NULL,c_1_2 INT NOT NULL,c_1_3 LARGEINT NOT NULL,c_1_4 DECIMAL(13, 11)  NOT NULL,c_1_5 ARRAY<INT> NOT NULL,c_1_6 DECIMAL(20, 17)  NOT NULL,c_1_7 DATE NOT NULL,c_1_8 ARRAY<INT> NOT NULL,c_1_9 DATE NOT NULL,c_1_10 ARRAY<STRING> NOT NULL,c_1_11 DECIMAL(37, 7)  NOT NULL,c_1_12 DECIMAL(26, 6)  NOT NULL,c_1_13 DATETIME NOT NULL) PRIMARY KEY (c_1_0) DISTRIBUTED BY HASH (c_1_0) BUCKETS 3 properties("replication_num"="3") ;
CREATE TABLE t2 (c_2_0 DATE NOT NULL,c_2_1 ARRAY<INT> NOT NULL,c_2_2 DECIMAL(19, 11)  NOT NULL,c_2_3 BIGINT NOT NULL,c_2_4 FLOAT NOT NULL,c_2_5 BOOLEAN NOT NULL,c_2_6 ARRAY<INT> NOT NULL,c_2_7 BOOLEAN NOT NULL,c_2_8 SMALLINT NOT NULL,c_2_9 BOOLEAN NOT NULL,c_2_10 VARCHAR(21) NOT NULL,c_2_11 DATE NOT NULL,c_2_12 ARRAY<INT> NOT NULL,c_2_13 LARGEINT NOT NULL,c_2_14 DECIMAL(19, 1)  NOT NULL,c_2_15 VARCHAR(1) NOT NULL,c_2_16 DATE NOT NULL,c_2_17 DATETIME NOT NULL,c_2_18 VARCHAR(1) NOT NULL, INDEX index1_c_2_9(`c_2_9`) USING BITMAP) PRIMARY KEY (c_2_0) PARTITION BY RANGE(c_2_0) (START ("2010-01-01") END ("2021-12-31") EVERY (INTERVAL 199 day)) DISTRIBUTED BY HASH (c_2_0) BUCKETS 3 properties("replication_num"="3") ;
CREATE TABLE t3 (c_3_0 DATETIME NULL ,c_3_1 BIGINT NULL ,c_3_2 DECIMAL(11, 6)  NULL ,c_3_3 DATETIME NOT NULL ,c_3_4 BOOLEAN NOT NULL ,c_3_5 ARRAY<STRING> NULL ,c_3_6 BOOLEAN NULL ,c_3_7 DATETIME NULL ,c_3_8 ARRAY<INT> NULL ,c_3_9 ARRAY<INT> NULL ,c_3_10 DECIMAL(1, 0)  NULL ,c_3_11 BOOLEAN NULL ,c_3_12 DATETIME NOT NULL ,c_3_13 DECIMAL(12, 6)  NULL ,c_3_14 DATETIME NULL ,c_3_15 ARRAY<INT> NULL ,c_3_16 DATE NULL ,c_3_17 DECIMAL(11, 9)  NOT NULL ) UNIQUE KEY (c_3_0,c_3_1,c_3_2) PARTITION BY RANGE(c_3_0) (START ("2010-01-01") END ("2021-12-31") EVERY (INTERVAL 398 day)) DISTRIBUTED BY HASH (c_3_2,c_3_1,c_3_0) BUCKETS 3 properties("replication_num"="3", "bloom_filter_columns"="c_3_1") ;
INSERT INTO t3 VALUES ("2010-01-18 08:00:14", 1675167623, 0.040160, "2010-01-14 08:00:14", false, ["q", "0Phb2p3", "5", "", "L", "LQALNr3P", "9pu5TB6", "", "", "w", "ewDmUxmne", "7", "4Zam", "", "IwBfghp"], false, "2010-01-05 08:00:14", [-670758566, -670758566, -1482870066, 1666791915, -12986184, 1902351324, -147791310], [], 6, false, "2010-01-24 08:00:14", 0.525428, "2010-01-22 08:00:14", [-329608535, -1506277829, -182607980, -1154648433], "2010-01-26", 4.0E-8);
DELETE FROM t0 WHERE c_0_3=655710836831.4205413253;
INSERT INTO t2 VALUES ("2010-01-07", [-1303045045, 983886176, 769665597, -1154648433, -147791310, -1622106226, -9223372036854775808, 2008235736, -2024179577], 0.00078738586, 1998792416, -1.2986184E7, true, [-1907983456, 1886772815, -300616781, 432997259, -306833505, 1834356431, 432997259, -528432740, 665141643, 682011648, 485610010, 1834356431], false, 5, false, "", "2010-01-19", [-166531180, -342501991, -224370018, -354386830, -1007470045, -583176012, -1303045045, -496118093, 432997259], 1720150928, 40655178733335558.5, "", "2010-01-18", "2010-01-23 08:00:14", "");
INSERT INTO t1 VALUES ("dTL", "", 24, -83792536, 6.6E-10, [1344457666, -1419987695, 1768378422, -769505064, 1135352794, 948595116, 665141643, 2145246352], 3.60E-15, "2009-12-31", [248739186, 1998792416, -182607980, -306833505, 2105786476, 1931612865], "2010-01-23", ["", "dF"], 310464228068669793679.7902031, 497485195821.067900, "2010-01-29 08:00:14"), ("9", "", 1, 682011648, 3.0E-10, [1242619036, 2000547711, 632978919, 1999454407], 9.7E-16, "2010-01-20", [985131940, 1056744102, 256933524, 1883141305], "2010-01-22", [], 23732048994274728499330.7399503, 69106153562392.505732, "2010-01-10 08:00:14"), ("", "", 0, 58591407, 6.2E-10, [196605451, -1807300807, -1048626590, 178697329, -404721556, 2008235736], 5.75E-15, "2010-01-28", [], "2010-01-05", ["UYgfZk", "bOz4n69", "MBv0", "Kj", "", "", "8cBnE", "eacB", "72", "Vdipn", "0"], 79615072919815832881519.3574001, 63367470993974.900112, "2010-01-28 08:00:14");
CREATE VIEW v0 AS SELECT t2.c_2_0, t2.c_2_2, t2.c_2_3, t2.c_2_4, t2.c_2_5, t2.c_2_7, t2.c_2_8, t2.c_2_9, t2.c_2_10, t2.c_2_11, t2.c_2_13, t2.c_2_14, t2.c_2_15, t2.c_2_16, t2.c_2_17, t2.c_2_18, t1.c_1_0, t1.c_1_1, t1.c_1_2, t1.c_1_3, t1.c_1_4, t1.c_1_6, t1.c_1_7, t1.c_1_9, t1.c_1_11, t1.c_1_12, t1.c_1_13, t3.c_3_0, t3.c_3_1, t3.c_3_2, t3.c_3_3, t3.c_3_4, t3.c_3_6, t3.c_3_7, t3.c_3_10, t3.c_3_11, t3.c_3_12, t3.c_3_13, t3.c_3_14, t3.c_3_16, t3.c_3_17 FROM t2, t1, t3 WHERE (NOT (false)) GROUP BY t2.c_2_0, t2.c_2_2, t2.c_2_3, t2.c_2_4, t2.c_2_5, t2.c_2_7, t2.c_2_8, t2.c_2_9, t2.c_2_10, t2.c_2_11, t2.c_2_13, t2.c_2_14, t2.c_2_15, t2.c_2_16, t2.c_2_17, t2.c_2_18, t1.c_1_0, t1.c_1_1, t1.c_1_2, t1.c_1_3, t1.c_1_4, t1.c_1_6, t1.c_1_7, t1.c_1_9, t1.c_1_11, t1.c_1_12, t1.c_1_13, t3.c_3_0, t3.c_3_1, t3.c_3_2, t3.c_3_3, t3.c_3_4, t3.c_3_6, t3.c_3_7, t3.c_3_10, t3.c_3_11, t3.c_3_12, t3.c_3_13, t3.c_3_14, t3.c_3_16, t3.c_3_17 ORDER BY t3.c_3_1, t1.c_1_6, t2.c_2_9, t3.c_3_12, t3.c_3_10, t2.c_2_4, t3.c_3_7, t3.c_3_16, t3.c_3_10, t3.c_3_17, t1.c_1_7, t2.c_2_18, t2.c_2_3, t3.c_3_1, t1.c_1_1, t2.c_2_5, t3.c_3_4, t2.c_2_8, t1.c_1_9, t1.c_1_3, t3.c_3_7, t2.c_2_4, t2.c_2_11, t2.c_2_13, t2.c_2_3, t1.c_1_13, t1.c_1_7, t2.c_2_18, t2.c_2_7, t2.c_2_11, t1.c_1_11, t1.c_1_12, t3.c_3_3, t3.c_3_12, t2.c_2_5, t3.c_3_10, t3.c_3_11, t1.c_1_7, t2.c_2_3, t2.c_2_13, t2.c_2_7, t1.c_1_7, t2.c_2_4, t3.c_3_6, t3.c_3_17;
TRUNCATE TABLE t1;
SELECT t3.c_3_2, subt1.c_1_7, t3.c_3_3, t3.c_3_13, subt1.c_1_12, subt1.c_1_1, t3.c_3_12, subt1.c_1_0, t3.c_3_11, subt1.c_1_6, t3.c_3_7, subt1.c_1_3, subt1.c_1_2, t3.c_3_14, subt1.c_1_13, subt1.c_1_11, subt1.c_1_4, t3.c_3_17, t3.c_3_1, subt1.c_1_9, t3.c_3_6 FROM t0, v0,  t3 INNER JOIN (SELECT t1.c_1_0, t1.c_1_1, t1.c_1_2, t1.c_1_3, t1.c_1_4, t1.c_1_6, t1.c_1_7, t1.c_1_9, t1.c_1_11, t1.c_1_12, t1.c_1_13 FROM t1 WHERE  ( t1.c_1_9 ) >= ( t1.c_1_9 )  ORDER BY t1.c_1_12 DESC) subt1 ON t3.c_3_14 != subt1.c_1_0 AND t3.c_3_14 != (("D")||("j")) WHERE JSON_EXISTS(CAST(t3.c_3_2 AS JSON ) , AES_ENCRYPT("W", "W") )  GROUP BY t3.c_3_2, subt1.c_1_7, t3.c_3_3, t3.c_3_13, subt1.c_1_12, subt1.c_1_1, t3.c_3_12, subt1.c_1_0, t3.c_3_11, subt1.c_1_6, t3.c_3_7, subt1.c_1_3, subt1.c_1_2, t3.c_3_14, subt1.c_1_13, subt1.c_1_11, subt1.c_1_4, t3.c_3_17, t3.c_3_1, subt1.c_1_9, t3.c_3_6 UNION SELECT t3.c_3_2, subt1.c_1_7, t3.c_3_3, t3.c_3_13, subt1.c_1_12, subt1.c_1_1, t3.c_3_12, subt1.c_1_0, t3.c_3_11, subt1.c_1_6, t3.c_3_7, subt1.c_1_3, subt1.c_1_2, t3.c_3_14, subt1.c_1_13, subt1.c_1_11, subt1.c_1_4, t3.c_3_17, t3.c_3_1, subt1.c_1_9, t3.c_3_6 FROM t0, v0,  t3 INNER JOIN (SELECT t1.c_1_0, t1.c_1_1, t1.c_1_2, t1.c_1_3, t1.c_1_4, t1.c_1_6, t1.c_1_7, t1.c_1_9, t1.c_1_11, t1.c_1_12, t1.c_1_13 FROM t1 WHERE  ( t1.c_1_9 ) >= ( t1.c_1_9 )  ORDER BY t1.c_1_12 DESC) subt1 ON t3.c_3_14 != subt1.c_1_0 AND t3.c_3_14 != (("D")||("j")) WHERE (NOT (JSON_EXISTS(CAST(t3.c_3_2 AS JSON ) , AES_ENCRYPT("W", "W") ) )) GROUP BY t3.c_3_2, subt1.c_1_7, t3.c_3_3, t3.c_3_13, subt1.c_1_12, subt1.c_1_1, t3.c_3_12, subt1.c_1_0, t3.c_3_11, subt1.c_1_6, t3.c_3_7, subt1.c_1_3, subt1.c_1_2, t3.c_3_14, subt1.c_1_13, subt1.c_1_11, subt1.c_1_4, t3.c_3_17, t3.c_3_1, subt1.c_1_9, t3.c_3_6 UNION SELECT t3.c_3_2, subt1.c_1_7, t3.c_3_3, t3.c_3_13, subt1.c_1_12, subt1.c_1_1, t3.c_3_12, subt1.c_1_0, t3.c_3_11, subt1.c_1_6, t3.c_3_7, subt1.c_1_3, subt1.c_1_2, t3.c_3_14, subt1.c_1_13, subt1.c_1_11, subt1.c_1_4, t3.c_3_17, t3.c_3_1, subt1.c_1_9, t3.c_3_6 FROM t0, v0,  t3 INNER JOIN (SELECT t1.c_1_0, t1.c_1_1, t1.c_1_2, t1.c_1_3, t1.c_1_4, t1.c_1_6, t1.c_1_7, t1.c_1_9, t1.c_1_11, t1.c_1_12, t1.c_1_13 FROM t1 WHERE  ( t1.c_1_9 ) >= ( t1.c_1_9 )  ORDER BY t1.c_1_12 DESC) subt1 ON t3.c_3_14 != subt1.c_1_0 AND t3.c_3_14 != (("D")||("j")) WHERE ((JSON_EXISTS(CAST(t3.c_3_2 AS JSON ) , AES_ENCRYPT("W", "W") ) ) IS NULL) GROUP BY t3.c_3_2, subt1.c_1_7, t3.c_3_3, t3.c_3_13, subt1.c_1_12, subt1.c_1_1, t3.c_3_12, subt1.c_1_0, t3.c_3_11, subt1.c_1_6, t3.c_3_7, subt1.c_1_3, subt1.c_1_2, t3.c_3_14, subt1.c_1_13, subt1.c_1_11, subt1.c_1_4, t3.c_3_17, t3.c_3_1, subt1.c_1_9, t3.c_3_6;

crash.log:
==30340==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7feb640cc380; bottom 0x7fea823e2000; size: 0x0000e1cea380 (3788415872)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
terminate called after throwing an instance of 'boost::wrapexcept<boost::escaped_list_error>'
  what():  unknown escape sequence
terminate called recursively
*** Aborted at 1650299679 (unix time) try "date -d @1650299679" if you are using GNU date ***
terminate called recursively
PC: @     0x7fec16aed387 __GI_raise
*** SIGABRT (@0x3e800007684) received by PID 30340 (TID 0x7feb5f561700) from PID 30340; stack trace: ***
    @     0x7fec175a2630 (unknown)
    @     0x7fec16aed387 __GI_raise
    @     0x7fec16aeea78 __GI_abort
    @          0x42647ef _ZN9__gnu_cxx27__verbose_terminate_handlerEv.cold
    @          0xbacf856 __cxxabiv1::__terminate()
    @          0xbacf8c1 std::terminate()
    @          0xbacfa14 __cxa_throw
    @          0x8e25aa1 boost::throw_exception<>()
    @          0x8e24fc1 boost::escaped_list_separator<>::do_escape<>()
    @          0x8e24067 boost::escaped_list_separator<>::operator()<>()
    @          0x8e2286f boost::token_iterator<>::initialize()
    @          0x8e19ec2 boost::token_iterator<>::token_iterator()
    @          0x8de022a boost::tokenizer<>::begin()
    @          0x8e2a2bb starrocks::vectorized::JsonPathPiece::parse()
    @          0x8e2c745 starrocks::vectorized::JsonPath::parse()
    @          0x8dd843d starrocks::vectorized::JsonFunctions::native_json_path_prepare()
    @          0x8cc1a14 starrocks::vectorized::VectorizedFunctionCallExpr::open()
    @          0x8164cd7 starrocks::Expr::open()
    @          0x81593d2 starrocks::ExprContext::open()
    @          0x8164788 starrocks::Expr::open()
    @          0x6feae82 starrocks::pipeline::ScanOperatorFactory::prepare()
    @          0x6f6ea0c starrocks::pipeline::Pipeline::prepare()
    @          0x6f71c5d starrocks::pipeline::FragmentContext::prepare_all_pipelines()
    @          0x6f65dfa starrocks::pipeline::FragmentExecutor::prepare()
    @          0x57deae0 starrocks::PInternalServiceImpl<>::_exec_plan_fragment()
    @          0x57da0c0 starrocks::PInternalServiceImpl<>::exec_plan_fragment()
    @          0x6118e4e doris::PBackendService::CallMethod()
    @          0xa14ac9e brpc::policy::ProcessRpcRequest()
    @          0xa141707 brpc::ProcessInputMessage()
    @          0xa0f73ff bthread::TaskGroup::task_runner()
    @          0xa27f331 bthread_make_fcontext

### StarRocks version (Required)
 - You can get the StarRocks version by executing SQL `select current_version()`
 - branch-2.2 ASAN
 - mysql> select current_version();
+------------------------------+
| current_version()            |
+------------------------------+
| SQLANCER_01_ASAN e59d04a |
+------------------------------+
@wanpengfei-git wanpengfei-git added type/bug Something isn't working sqlancer labels Apr 19, 2022
@wanpengfei-git wanpengfei-git added this to the 2.2 milestone Apr 19, 2022
@murphyatwork
Copy link
Contributor

Root cause is this expression: JSON_EXISTS(CAST(t3.c_3_2 AS JSON ) , AES_ENCRYPT("W", "W") ) , the aes_encrypt create an illegal utf-8 string.

murphyatwork added a commit to murphyatwork/starrocks that referenced this issue Apr 21, 2022
mergify bot pushed a commit that referenced this issue Apr 21, 2022
@ZiheLiu ZiheLiu mentioned this issue Apr 25, 2022
blackstar-baba pushed a commit to blackstar-baba/starrocks that referenced this issue Apr 28, 2022
jaogoy pushed a commit to jaogoy/starrocks that referenced this issue Nov 15, 2023
jaogoy pushed a commit to jaogoy/starrocks that referenced this issue Nov 15, 2023
Signed-off-by: EsoragotoSpirit <[email protected]>
(cherry picked from commit 8352a12)

Co-authored-by: 絵空事スピリット <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sqlancer type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants