[MDEV-32311] Server crashes at st_select_lex_unit::save_union_explain Created: 2023-09-30  Updated: 2023-10-04  Resolved: 2023-10-03

Status: Closed
Project: MariaDB Server
Component/s: N/A
Affects Version/s: 11.1.2, 11.2.1
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Jingzhou Fu Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Environment:

Ubuntu 20.04 x86-64, docker image mariadb:11.1.2


Issue Links:
Duplicate
duplicates MDEV-28621 eliminated subquery: Server crash in ... Confirmed

 Description   

PoC:

SELECT ( ( WITH x ( x ) AS ( SELECT ( SELECT 'x' UNION SELECT 'x' ) FROM ( SELECT ( 'x' ) ) x ) SELECT x FROM x WHERE x IN ( ( SELECT 'x' AND x GROUP BY x ) ) ) ) ;

docker log:

mariadbd(my_print_stacktrace+0x32)[0x55e6539d97c2]
mariadbd(handle_fatal_signal+0x488)[0x55e6534b2cf8]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f0493a00520]
mariadbd(_ZN18st_select_lex_unit18save_union_explainEP13Explain_query+0x23)[0x55e653219583]
mariadbd(_ZN18st_select_lex_unit10exec_innerEv+0xfa)[0x55e653313e8a]
mariadbd(_ZN22subselect_union_engine4execEv+0x22)[0x55e653591262]
mariadbd(_ZN14Item_subselect4execEv+0x4c)[0x55e65359173c]
mariadbd(_ZN24Item_singlerow_subselect7val_strEP6String+0x29)[0x55e653593ff9]
mariadbd(_ZN20Item_direct_view_ref10str_resultEP6String+0x23)[0x55e6534c7eb3]
mariadbd(_ZN14Item_cache_str11cache_valueEv+0x70)[0x55e6534c9e10]
mariadbd(_ZN17Item_in_optimizer8fix_leftEP3THD+0x2b5)[0x55e6534f8f05]
mariadbd(_ZN17Item_in_subselect26select_in_like_transformerEP4JOIN+0xcb)[0x55e6535977fb]
mariadbd(_Z33check_and_do_in_subquery_rewritesP4JOIN+0x3d4)[0x55e6533afaf4]
mariadbd(_ZN4JOIN7prepareEP10TABLE_LISTP4ItemjP8st_orderbS5_S3_S5_P13st_select_lexP18st_select_lex_unit+0xdca)[0x55e6532ac5ba]
mariadbd(+0xb8b908)[0x55e653598908]
mariadbd(_ZN14Item_subselect10fix_fieldsEP3THDPP4Item+0x1ad)[0x55e653597fcd]
mariadbd(_ZN17Item_in_subselect10fix_fieldsEP3THDPP4Item+0x85)[0x55e6535982d5]
mariadbd(_Z11setup_condsP3THDP10TABLE_LISTR4ListIS1_EPP4Item+0x22f)[0x55e6531d3e6f]
mariadbd(_ZN4JOIN7prepareEP10TABLE_LISTP4ItemjP8st_orderbS5_S3_S5_P13st_select_lexP18st_select_lex_unit+0x620)[0x55e6532abe10]
mariadbd(+0xb8b908)[0x55e653598908]
mariadbd(_ZN14Item_subselect10fix_fieldsEP3THDPP4Item+0x1ad)[0x55e653597fcd]
mariadbd(_Z12setup_fieldsP3THD20Bounds_checked_arrayIP4ItemER4ListIS2_E17enum_column_usagePS6_S9_b+0x147)[0x55e6531d20a7]
mariadbd(_ZN4JOIN7prepareEP10TABLE_LISTP4ItemjP8st_orderbS5_S3_S5_P13st_select_lexP18st_select_lex_unit+0x52d)[0x55e6532abd1d]
mariadbd(_Z12mysql_selectP3THDP10TABLE_LISTR4ListI4ItemEPS4_jP8st_orderS9_S7_S9_yP13select_resultP18st_select_lex_unitP13st_select_lex+0x624)[0x55e6532c0474]
mariadbd(_Z13handle_selectP3THDP3LEXP13select_resulty+0x154)[0x55e6532c0774]
mariadbd(+0x826f55)[0x55e653233f55]
mariadbd(_Z21mysql_execute_commandP3THDb+0x419e)[0x55e653242f0e]
mariadbd(_Z11mysql_parseP3THDPcjP12Parser_state+0x1e7)[0x55e653244237]
mariadbd(_Z16dispatch_command19enum_server_commandP3THDPcjb+0x14bd)[0x55e653246a1d]
mariadbd(_Z10do_commandP3THDb+0x138)[0x55e653248818]
mariadbd(_Z24do_handle_one_connectionP7CONNECTb+0x3bf)[0x55e6533703af]
mariadbd(handle_one_connection+0x5d)[0x55e6533706fd]
mariadbd(+0xcd1906)[0x55e6536de906]
/lib/x86_64-linux-gnu/libc.so.6(+0x94b43)[0x7f0493a52b43]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x44)[0x7f0493ae3bb4]
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7f042c0130d8): SELECT ( ( WITH x ( x ) AS ( SELECT ( SELECT 'x' UNION SELECT 'x' ) FROM ( SELECT ( 'x' ) ) x ) SELECT x FROM x WHERE x IN ( ( SELECT 'x' AND x GROUP BY x ) ) ) )
 
Connection ID (thread ID): 4
Status: NOT_KILLED
 
Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=on



 Comments   
Comment by Alice Sherepa [ 2023-10-03 ]

Thanks! This is the same as MDEV-28621. I will add the test case there to be checked after the patch

Generated at Thu Feb 08 10:30:24 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.