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

[Bug]: This following SQL query caused observer crash. #1131

Closed
2 tasks done
imbawenzi opened this issue Nov 19, 2022 · 3 comments
Closed
2 tasks done

[Bug]: This following SQL query caused observer crash. #1131

imbawenzi opened this issue Nov 19, 2022 · 3 comments
Assignees
Labels
type: bug Something isn't working

Comments

@imbawenzi
Copy link

Please check the issue list for the same bug

  • Please checked issue list and confirm this bug is encountered for the first time.
  • Please try full text in English and attach precise description.

Environment

- OceanBase_CE 4.0.0.0 (r1-c36622e1c881c561d583e6138d4fe2c6ad32a413)
- Linux version 3.10.0-1160.76.1.el7.x86_64
- obclient  Ver  Distrib 10.4.18-MariaDB, for Linux (x86_64) using readline 5.1

Fast Reproduce Steps(Required)

CREATE TABLE v0 ( v1 INT, v2 INT , v3 INT) ;
INSERT INTO v0 VALUES (1, 2, 3);
INSERT INTO v0 VALUES (3, 2, 1);
CREATE TABLE v4 ( v5 INT, v6 INT , v7 INT) ;
INSERT INTO v4 VALUES (4, 5, 6);
INSERT INTO v4 VALUES (6, 5, 4);
SELECT DISTINCT v3 FROM v0 WHERE v3 IN ( ( SELECT v1 FROM ( WITH v1089 AS ( SELECT v3 FROM v0 ) SELECT v1 FROM ( SELECT v2 , ( v3 = 38 OR v3 > 'x' ) FROM v0 WHERE v3 > 58 OR v1 > 88 AND v3 < ( SELECT v6 FROM v4 AS v1090 GROUP BY v7 + -128 , v5 ) ) AS v1091 NATURAL JOIN v0 ) AS v1092 GROUP BY v1 HAVING v1 = ( SELECT v5 FROM v4 WHERE 'x' / v6 = v6 + CASE v7 WHEN TRUE THEN ( ( ( EXISTS ( SELECT 7 ) AND ( ( v5 % ( SELECT v1 FROM v0 UNION SELECT v5 FROM ( SELECT v5 FROM ( WITH v1096 AS ( SELECT v5 FROM ( SELECT v5 FROM v4 WHERE FALSE WINDOW v1094 AS ( PARTITION BY v7 ) ) AS v1095 ) SELECT DISTINCT v5 , ( v5 = 127 OR v5 > 'x' ) FROM v1096 ) AS v1097 NATURAL JOIN v4 WHERE v5 WINDOW v1098 AS ( PARTITION BY v5 ) ) AS v1099 ORDER BY v1 IN ( - 64 , ( v3 % ( SELECT v2 FROM v0 UNION SELECT TRUE FROM v0 AS v1093 ORDER BY v2 LIMIT 1 ) AND 49 ) ) ASC LIMIT 1 ) <= v6 OR NOT v5 ) ) ) BETWEEN 84 AND 16 ) ) ELSE 2147483647 END OR v5 = v6 ) * 51 ) ) ;

Actual Behavior

observer crashed

Expected Behavior

No response

other information

(gdb) bt
#0 0x0000000006bbc29f in oceanbase::common::ObDatumPayload<(oceanbase::common::ObObjTypeClass)1>::get(oceanbase::common::ObDatum const&) (d=...) at ./src/share/datum/ob_datum.h:448
#1 0x0000000006baf799 in oceanbase::common::datum_cmp::ObTCPayloadCmp<(oceanbase::common::ObObjTypeClass)1>::cmp(oceanbase::common::ObDatum const&, oceanbase::common::ObDatum const&)
(l=..., r=...) at ./src/share/datum/ob_datum_cmp_func_def.h:60
#2 0x0000000006c67550 in oceanbase::sql::ObRelationalTCFunc<true, (oceanbase::common::ObObjTypeClass)1, (oceanbase::common::ObObjTypeClass)1, (oceanbase::common::ObCmpOp)0>::DatumCmp::operator()(oceanbase::common::ObDatum&, oceanbase::common::ObDatum const&, oceanbase::common::ObDatum const&) const (this=0x7fcb4b6511b8, res=..., l=..., r=...)
at ./src/sql/engine/expr/ob_expr_cmp_func.cpp:130
#3 0x00000000032fbce4 in oceanbase::sql::def_relational_eval_func<oceanbase::sql::ObRelationalTCFunc<true, (oceanbase::common::ObObjTypeClass)1, (oceanbase::common::ObObjTypeClass)1, (oceanbase::common::ObCmpOp)0>::DatumCmp>(oceanbase::sql::ObExpr const&, oceanbase::sql::ObEvalCtx&, oceanbase::common::ObDatum&) (expr=..., ctx=..., expr_datum=...)
at ./src/sql/engine/expr/ob_expr_cmp_func.cpp:56
#4 0x0000000003055f35 in oceanbase::sql::ObRelationalTCFunc<true, (oceanbase::common::ObObjTypeClass)1, (oceanbase::common::ObObjTypeClass)1, (oceanbase::common::ObCmpOp)0>::eval(oceanbase::sql::ObExpr const&, oceanbase::sql::ObEvalCtx&, oceanbase::common::ObDatum&) (expr=..., ctx=..., expr_datum=...) at ./src/sql/engine/expr/ob_expr_cmp_func.cpp:137
#5 0x0000000008d6f8b3 in oceanbase::sql::ObExpr::eval_one_datum_of_batch(oceanbase::sql::ObEvalCtx&, oceanbase::common::ObDatum*&) const (this=0x7fcb4a459b70, ctx=...,
datum=@0x7fcb4b651418: 0x7fcb1666cee4) at ./src/sql/engine/expr/ob_expr.cpp:602
#6 0x00000000075d021c in eval (this=0x7fcb4a459b70, ctx=..., datum=@0x7fcb4b651418: 0x7fcb1666cee4) at ./src/sql/engine/expr/ob_expr.h:983
#7 oceanbase::sql::calc_or_exprN(oceanbase::sql::ObExpr const&, oceanbase::sql::ObEvalCtx&, oceanbase::common::ObDatum&) (expr=..., ctx=..., res_datum=...)
at ./src/sql/engine/expr/ob_expr_or.cpp:124
#8 0x0000000008d6f8b3 in oceanbase::sql::ObExpr::eval_one_datum_of_batch(oceanbase::sql::ObEvalCtx&, oceanbase::common::ObDatum*&) const (this=0x7fcb4a459ac0, ctx=...,
datum=@0x7fcb4b6515b8: 0x7fcb1666c2c4) at ./src/sql/engine/expr/ob_expr.cpp:602
#9 0x0000000007da6988 in eval (this=0x7fcb4a459ac0, ctx=..., datum=@0x7fcb4b6515b8: 0x7fcb1666c2c4) at ./src/sql/engine/expr/ob_expr.h:983
#10 oceanbase::sql::ObSubPlanFilterOp::prepare_onetime_exprs_inner() (this=0x7fcb166ca130) at ./src/sql/engine/subquery/ob_subplan_filter_op.cpp:940
#11 0x0000000007d9c42e in oceanbase::sql::ObSubPlanFilterOp::prepare_onetime_exprs() (this=0x7fcb166ca130) at ./src/sql/engine/subquery/ob_subplan_filter_op.cpp:917
#12 0x0000000007d9bbe8 in oceanbase::sql::ObSubPlanFilterOp::rescan() (this=0x7fcb166ca130) at ./src/sql/engine/subquery/ob_subplan_filter_op.cpp:403
#13 0x0000000007cd49f4 in oceanbase::sql::ObOperator::rescan() (this=0x7fcb166c9e78) at ./src/sql/engine/ob_operator.cpp:698
#14 0x0000000007d9b98d in oceanbase::sql::ObSubPlanFilterOp::rescan() (this=0x7fcb166c78f8) at ./src/sql/engine/subquery/ob_subplan_filter_op.cpp:383
#15 0x0000000007d9b98d in oceanbase::sql::ObSubPlanFilterOp::rescan() (this=0x7fcb166c4708) at ./src/sql/engine/subquery/ob_subplan_filter_op.cpp:383
#16 0x0000000007d93ceb in oceanbase::sql::ObSubQueryIterator::rewind(bool) (this=0x7fcb166e6e70, reset_onetime_plan=false) at ./src/sql/engine/subquery/ob_subplan_filter_op.cpp:85
#17 0x0000000008a7f776 in oceanbase::sql::ObExprSubQueryRef::expr_eval(oceanbase::sql::ObExpr const&, oceanbase::sql::ObEvalCtx&, oceanbase::common::ObDatum&) (expr=..., ctx=...,
expr_datum=...) at ./src/sql/engine/expr/ob_expr_subquery_ref.cpp:315
#18 0x0000000008d6f8b3 in oceanbase::sql::ObExpr::eval_one_datum_of_batch(oceanbase::sql::ObEvalCtx&, oceanbase::common::ObDatum*&) const (this=0x7fcb4a456680, ctx=...,
datum=@0x7fcb4b651e38: 0x7fcb16644c2c) at ./src/sql/engine/expr/ob_expr.cpp:602
#19 0x000000000758c9f9 in eval (this=0x7fcb4a456680, ctx=..., datum=@0x7fcb4b651e38: 0x7fcb16644c2c) at ./src/sql/engine/expr/ob_expr.h:983
#20 oceanbase::sql::ObSubQueryRelationalExpr::setup_row(oceanbase::sql::ObExpr**, oceanbase::sql::ObEvalCtx&, bool, long, oceanbase::sql::ObSubQueryIterator*&, oceanbase::sql::ObExpr**&, oceanbase::sql::ObEvalCtx*&) (expr=0x7fcb3bd70098, ctx=..., is_iter=true, cmp_func_cnt=1, iter=@0x7fcb4b651f48: 0x0, row=@0x7fcb4b651f38: 0x0,
used_ctx=@0x7fcb4b651f28: 0x7fcb166c28d8) at ./src/sql/engine/expr/ob_expr_operator.cpp:3377
#21 0x000000000758b8df in oceanbase::sql::ObSubQueryRelationalExpr::subquery_cmp_eval(oceanbase::sql::ObExpr const&, oceanbase::sql::ObEvalCtx&, oceanbase::common::ObDatum&) (
expr=..., ctx=..., expr_datum=...) at ./src/sql/engine/expr/ob_expr_operator.cpp:3437
#22 0x0000000008d6f8b3 in oceanbase::sql::ObExpr::eval_one_datum_of_batch(oceanbase::sql::ObEvalCtx&, oceanbase::common::ObDatum*&) const (this=0x7fcb4a4567e0, ctx=...,
datum=@0x7fcb4b6520b8: 0x7fcb1664584c) at ./src/sql/engine/expr/ob_expr.cpp:602
---Type to continue, or q to quit---
#23 0x00000000032fb2a0 in eval (this=0x7fcb4a4567e0, ctx=..., datum=@0x7fcb4b6520b8: 0x7fcb1664584c) at ./src/sql/engine/expr/ob_expr.h:983
#24 oceanbase::sql::ObOperator::filter_row(oceanbase::sql::ObEvalCtx&, oceanbase::common::ObIArrayoceanbase::sql::ObExpr* const&, bool&) (eval_ctx=..., exprs=...,
filtered=@0x7fcb4b6522cf: false) at ./src/sql/engine/ob_operator.cpp:1119
#25 0x0000000007da4fe3 in oceanbase::sql::ObSubPlanFilterOp::inner_get_next_batch(long) (this=0x7fcb166c28c0, max_row_cnt=256)
at ./src/sql/engine/subquery/ob_subplan_filter_op.cpp:843
#26 0x0000000007cd7209 in oceanbase::sql::ObOperator::get_next_batch(long, oceanbase::sql::ObBatchRows const*&) (this=0x7fcb166c28c0, max_row_cnt=256,
batch_rows=@0x7fcb4b652870: 0x7fcb166c2ab0) at ./src/sql/engine/ob_operator.cpp:1026
#27 0x00000000076d62e6 in oceanbase::sql::ObHashDistinctOp::build_distinct_data_for_batch(long, bool) (this=0x7fcb166c1028, batch_size=256, is_block=false)
at ./src/sql/engine/aggregate/ob_hash_distinct_op.cpp:316
#28 0x00000000076d846c in oceanbase::sql::ObHashDistinctOp::do_unblock_distinct_for_batch(long) (this=0x7fcb166c1028, batch_size=256)
at ./src/sql/engine/aggregate/ob_hash_distinct_op.cpp:521
#29 0x00000000076e09e5 in oceanbase::sql::ObHashDistinctOp::inner_get_next_batch(long) (this=0x7fcb166c1028, max_row_cnt=9223372036854775807)
at ./src/sql/engine/aggregate/ob_hash_distinct_op.cpp:692
#30 0x0000000007cd7209 in oceanbase::sql::ObOperator::get_next_batch(long, oceanbase::sql::ObBatchRows const*&) (this=0x7fcb166c1028, max_row_cnt=9223372036854775807,
batch_rows=@0x7fcb4b652e80: 0x7fcb166c1218) at ./src/sql/engine/ob_operator.cpp:1026
#31 0x000000000785b056 in oceanbase::sql::ObTempTableTransformationOp::inner_get_next_batch(long) (this=0x7fcb166bc5a0, max_row_cnt=9223372036854775807)
at ./src/sql/engine/basic/ob_temp_table_transformation_op.cpp:115
#32 0x0000000007cd7209 in oceanbase::sql::ObOperator::get_next_batch(long, oceanbase::sql::ObBatchRows const*&) (this=0x7fcb166bc5a0, max_row_cnt=9223372036854775807,
batch_rows=@0x7fcb4b654290: 0x7fcb166bc790) at ./src/sql/engine/ob_operator.cpp:1026
#33 0x0000000007cdb182 in oceanbase::sql::ObBatchRowIter::get_next_row() (this=0x7fcb4b654288) at ./src/sql/engine/ob_operator.cpp:1285
#34 0x0000000002f48b4d in oceanbase::sql::ObExecuteResult::get_next_row(oceanbase::sql::ObExecContext&, oceanbase::common::ObNewRow const*&) (this=0x7fcb4b654250, ctx=...,
row=@0x7fcb4b653918: 0x7fcb4b654268) at ./src/sql/executor/ob_execute_result.cpp:70
#35 0x0000000002f48056 in inner_get_next_row (this=0x7fcb4b653dd0, row=@0x7fcb4b653918: 0x7fcb4b654268) at ./src/sql/ob_result_set.cpp:342
#36 oceanbase::sql::ObResultSet::get_next_row(oceanbase::common::ObNewRow const*&) (this=0x7fcb4b653dd0, row=@0x7fcb4b653918: 0x7fcb4b654268) at ./src/sql/ob_result_set.cpp:330
#37 0x0000000002f45704 in oceanbase::observer::ObQueryDriver::response_query_result(oceanbase::sql::ObResultSet&, bool, bool, bool&, long) (this=0x7fcb4b659670, result=...,
is_ps_protocol=false, has_more_result=false, can_retry=@0x7fcb4b653d6f: true, fetch_limit=-1) at ./src/observer/mysql/ob_query_driver.cpp:141
#38 0x0000000002f44303 in oceanbase::observer::ObSyncPlanDriver::response_result(oceanbase::observer::ObMySQLResultSet&) (this=0x7fcb4b659670, result=...)
at ./src/observer/mysql/ob_sync_plan_driver.cpp:95
#39 0x0000000002f3ab32 in response_result (this=0x7fcb17a04060, result=..., force_sync_resp=false, async_resp_used=@0x7fcb4b65a189: false) at ./src/observer/mysql/obmp_query.cpp:1219
#40 do_process (this=0x7fcb17a04060, session=..., has_more_result=false, force_sync_resp=false, async_resp_used=@0x7fcb4b65a189: false, need_disconnect=@0x7fcb4b65a18a: true)
at ./src/observer/mysql/obmp_query.cpp:806
#41 oceanbase::observer::ObMPQuery::process_single_stmt(oceanbase::sql::ObMultiStmtItem const&, oceanbase::sql::ObSQLSessionInfo&, bool, bool, bool&, bool&) (this=0x7fcb17a04060,
multi_stmt_item=..., session=..., has_more_result=false, force_sync_resp=false, async_resp_used=@0x7fcb4b65a189: false, need_disconnect=@0x7fcb4b65a18a: true)
at ./src/observer/mysql/obmp_query.cpp:530
#42 0x0000000002f355e9 in oceanbase::observer::ObMPQuery::process() (this=0x7fcb17a04060) at ./src/observer/mysql/obmp_query.cpp:345
#43 0x0000000002f32f81 in oceanbase::rpc::frame::ObSqlProcessor::run() (this=0x7fcb17a04060) at ./deps/oblib/src/rpc/frame/ob_sql_processor.cpp:41
#44 0x0000000003b15aca in oceanbase::omt::ObWorkerProcessor::process_one(oceanbase::rpc::ObRequest&) (this=0x7fcb507ab2c8, req=...) at ./src/observer/omt/ob_worker_processor.cpp:67
#45 0x0000000002f32b5f in oceanbase::omt::ObWorkerProcessor::process(oceanbase::rpc::ObRequest&) (this=0x7fcb507ab2c8, req=...) at ./src/observer/omt/ob_worker_processor.cpp:126
---Type to continue, or q to quit---
#46 0x0000000003b13619 in oceanbase::omt::ObThWorker::process_request(oceanbase::rpc::ObRequest&) (this=0x7fcb507ab1b0, req=...) at ./src/observer/omt/ob_th_worker.cpp:284
#47 0x0000000002f2e4c5 in oceanbase::omt::ObThWorker::worker(long&, long&, int&) (this=0x7fcb507ab1b0, tenant_id=@0x7fcb4b65b2c8: 1,
req_recv_timestamp=@0x7fcb4b65b2c0: 1668843947695280, worker_level=@0x7fcb4b65b2bc: 0) at ./src/observer/omt/ob_th_worker.cpp:444
#48 0x0000000003b13eac in oceanbase::omt::ObThWorker::run(long) (this=0x7fcb507ab1b0, idx=0) at ./src/observer/omt/ob_th_worker.cpp:483
#49 0x000000000cfdb864 in oceanbase::lib::Threads::start()::$_143::operator()() const (this=0x7fcb4b604120) at ./deps/oblib/src/lib/thread/threads.cpp:144
#50 0x000000000cfdb6ed in std::_Function_handler<void (), oceanbase::lib::Threads::start()::$_143>::_M_invoke(std::_Any_data const&) (__functor=...)
at ./deps/3rd/usr/local/oceanbase/devtools/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/std_function.h:300
#51 0x0000000003ad62ae in std::function<void ()>::operator()() const (this=0x7fcb4b604120)
at ./deps/3rd/usr/local/oceanbase/devtools/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/std_function.h:688
#52 0x000000000cfd0e87 in oceanbase::lib::Thread::__th_start(void*) (arg=0x7fcb4b604110) at ./deps/oblib/src/lib/thread/thread.cpp:227
#53 0x00007fcbe0a18ea5 in start_thread () from /lib64/libpthread.so.0
#54 0x00007fcbe0741b0d in clone () from /lib64/libc.so.6

@imbawenzi imbawenzi added the type: bug Something isn't working label Nov 19, 2022
@cyujing
Copy link

cyujing commented Nov 21, 2022

Thanks for your feedback, we are troubleshoot this bug later;

@shendachuan
Copy link
Contributor

Duplicate of #1123

@hnwyllmm
Copy link
Contributor

fixed.
Tested on 4.2.1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants