#2 0x00005558293a2ed9 in Item_equal::add_key_fields (this=0x153cdc026860, join=0x153cdc0255a0, key_fields=0x153cf77f9408, and_level=0x153cf77f9404, usable_tables=18446744073709551615, sargables=0x153cf77f9528) at /test/10.10_dbg/sql/sql_select.cc:6749
#3 0x00005558293a2354 in Item_cond::add_key_fields (this=<optimized out>, join=0x153cdc0255a0, key_fields=0x153cf77f9408, and_level=0x153cf77f9404, usable_tables=18446744073709551615, sargables=0x153cf77f9528) at /test/10.10_dbg/sql/sql_list.h:443
#4 0x00005558293a32a8 in update_ref_and_keys (thd=thd@entry=0x153cdc000db8, keyuse=keyuse@entry=0x153cdc0258c0, join_tab=0x153cdc0269c8, tables=1, cond=0x153cdc016e98, normal_tables=normal_tables@entry=18446744073709551615, select_lex=0x153cdc015188, sargables=0x153cf77f9528) at /test/10.10_dbg/sql/sql_select.cc:7178
#5 0x00005558293d9668 in make_join_statistics (join=join@entry=0x153cdc0255a0, tables_list=@0x153cdc0153a0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x153cdc025b58, last = 0x153cdc025b58, elements = 1}, <No data fields>}, keyuse_array=keyuse_array@entry=0x153cdc0258c0) at /test/10.10_dbg/sql/sql_select.cc:5430
#6 0x00005558293e2012 in JOIN::optimize_inner (this=this@entry=0x153cdc0255a0) at /test/10.10_dbg/sql/sql_select.cc:2503
#7 0x00005558293e2452 in JOIN::optimize (this=this@entry=0x153cdc0255a0) at /test/10.10_dbg/sql/sql_select.cc:1845
#8 0x0000555829326a24 in st_select_lex::optimize_unflattened_subqueries (this=0x153cdc013db8, const_only=const_only@entry=true) at /test/10.10_dbg/sql/sql_lex.cc:4916
#9 0x00005558295156a1 in JOIN::optimize_constant_subqueries (this=this@entry=0x153cdc024ad8) at /test/10.10_dbg/sql/opt_subselect.cc:5622
#10 0x00005558293e0f76 in JOIN::optimize_inner (this=this@entry=0x153cdc024ad8) at /test/10.10_dbg/sql/sql_select.cc:2165
#11 0x00005558293e2452 in JOIN::optimize (this=this@entry=0x153cdc024ad8) at /test/10.10_dbg/sql/sql_select.cc:1845
#12 0x00005558293e2545 in mysql_select (thd=thd@entry=0x153cdc000db8, tables=0x153cdc0143a0, fields=@0x153cdc014058: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x153cdc014348, last = 0x153cdc014348, elements = 1}, <No data fields>}, conds=0x153cdc014f48, og_num=1, order=0x0, group=0x153cdc015f80, having=0x0, proc_param=0x0, select_options=2147748608, result=0x153cdc024ab0, unit=0x153cdc004fd8, select_lex=0x153cdc013db8) at /test/10.10_dbg/sql/sql_select.cc:5030
#13 0x00005558293e2d8e in handle_select (thd=thd@entry=0x153cdc000db8, lex=lex@entry=0x153cdc004f00, result=result@entry=0x153cdc024ab0, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.10_dbg/sql/sql_select.cc:578
#14 0x000055582934eb5e in execute_sqlcom_select (thd=thd@entry=0x153cdc000db8, all_tables=0x153cdc0143a0) at /test/10.10_dbg/sql/sql_parse.cc:6260
#15 0x000055582935ae70 in mysql_execute_command (thd=thd@entry=0x153cdc000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.10_dbg/sql/sql_parse.cc:3944
#16 0x0000555829348e3a in mysql_parse (thd=thd@entry=0x153cdc000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x153cf77fa470) at /test/10.10_dbg/sql/sql_parse.cc:8036
#17 0x0000555829356422 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x153cdc000db8, packet=packet@entry=0x153cdc00b6d9 "SELECT * FROM c AS c WHERE c=c + 0 / 0 WINDOW c AS(ORDER BY (SELECT * FROM c GROUP BY c HAVING c=- 0 OR c>0 AND NOT c<c WINDOW c AS(PARTITION BY c)))", packet_length=packet_length@entry=149, blocking=blocking@entry=true) at /test/10.10_dbg/sql/sql_class.h:1364
#18 0x0000555829358b2c in do_command (thd=0x153cdc000db8, blocking=blocking@entry=true) at /test/10.10_dbg/sql/sql_parse.cc:1407
#19 0x00005558294b83c0 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55582c89dfb8, put_in_cache=put_in_cache@entry=true) at /test/10.10_dbg/sql/sql_connect.cc:1418
#20 0x00005558294b88c9 in handle_one_connection (arg=0x55582c89dfb8) at /test/10.10_dbg/sql/sql_connect.cc:1312
#21 0x0000153d30286609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#22 0x0000153d2fe72133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
MDEV-22825Server crashes in Bitmap<64u>::merge / add_key_field with condition_pushdown_for_subquery=on
Confirmed
MDEV-28509Server crash via Item_func_ne::add_key_fields in /sql/sql_bitmap.h:196, member access within null pointer of type 'struct JOIN_TAB' in add_key_field
SELECT * FROM c AS c WHERE c ISNULLOR c<0 / TRUE * 0 WINDOW c AS(PARTITION BY c AND -0 BETWEEN(SELECT * FROM c GROUPBY c HAVING ((c=c AND c BETWEEN 0 AND 0)) WINDOW c AS(PARTITION BY c)) AND -0);
#2 0x00005576cfbe80ca in add_key_equal_fields (join=join@entry=0x152008025860, key_fields=key_fields@entry=0x15203d10e408, and_level=0, cond=cond@entry=0x152008016a28, field_item=0x152008025060, eq_func=eq_func@entry=true, val=0x152008016b60, num_values=1, usable_tables=18446744073709551615, sargables=0x15203d10e528, row_col_no=0) at /test/10.10_dbg/sql/sql_select.cc:6421
#3 0x00005576cfbf17a7 in Item_func_between::add_key_fields (this=0x152008016a28, join=0x152008025860, key_fields=0x15203d10e408, and_level=0x15203d10e404, usable_tables=18446744073709551615, sargables=0x15203d10e528) at /test/10.10_dbg/sql/sql_select.cc:6587
#4 0x00005576cfbf12da in Item_cond_and::add_key_fields (this=<optimized out>, join=0x152008025860, key_fields=0x15203d10e408, and_level=0x15203d10e404, usable_tables=18446744073709551615, sargables=0x15203d10e528) at /test/10.10_dbg/sql/sql_select.cc:6496
#5 0x00005576cfbf22a8 in update_ref_and_keys (thd=thd@entry=0x152008000db8, keyuse=keyuse@entry=0x152008025b80, join_tab=0x152008026728, tables=1, cond=0x152008026610, normal_tables=normal_tables@entry=18446744073709551615, select_lex=0x152008015598, sargables=0x15203d10e528) at /test/10.10_dbg/sql/sql_select.cc:7178
#6 0x00005576cfc28668 in make_join_statistics (join=join@entry=0x152008025860, tables_list=@0x1520080157b0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x152008025e18, last = 0x152008025e18, elements = 1}, <No data fields>}, keyuse_array=keyuse_array@entry=0x152008025b80) at /test/10.10_dbg/sql/sql_select.cc:5430
#7 0x00005576cfc31012 in JOIN::optimize_inner (this=this@entry=0x152008025860) at /test/10.10_dbg/sql/sql_select.cc:2503
#8 0x00005576cfc31452 in JOIN::optimize (this=this@entry=0x152008025860) at /test/10.10_dbg/sql/sql_select.cc:1845
#9 0x00005576cfb75a24 in st_select_lex::optimize_unflattened_subqueries (this=0x152008013e18, const_only=const_only@entry=true) at /test/10.10_dbg/sql/sql_lex.cc:4916
#10 0x00005576cfd646a1 in JOIN::optimize_constant_subqueries (this=this@entry=0x152008024a98) at /test/10.10_dbg/sql/opt_subselect.cc:5622
#11 0x00005576cfc2ff76 in JOIN::optimize_inner (this=this@entry=0x152008024a98) at /test/10.10_dbg/sql/sql_select.cc:2165
#12 0x00005576cfc31452 in JOIN::optimize (this=this@entry=0x152008024a98) at /test/10.10_dbg/sql/sql_select.cc:1845
#13 0x00005576cfc31545 in mysql_select (thd=thd@entry=0x152008000db8, tables=0x152008014400, fields=@0x1520080140b8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x1520080143a8, last = 0x1520080143a8, elements = 1}, <No data fields>}, conds=0x1520080152f0, og_num=1, order=0x0, group=0x152008016390, having=0x0, proc_param=0x0, select_options=2147748608, result=0x152008024a70, unit=0x152008004fd8, select_lex=0x152008013e18) at /test/10.10_dbg/sql/sql_select.cc:5030
#14 0x00005576cfc31d8e in handle_select (thd=thd@entry=0x152008000db8, lex=lex@entry=0x152008004f00, result=result@entry=0x152008024a70, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.10_dbg/sql/sql_select.cc:578
#15 0x00005576cfb9db5e in execute_sqlcom_select (thd=thd@entry=0x152008000db8, all_tables=0x152008014400) at /test/10.10_dbg/sql/sql_parse.cc:6260
#16 0x00005576cfba9e70 in mysql_execute_command (thd=thd@entry=0x152008000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.10_dbg/sql/sql_parse.cc:3944
#17 0x00005576cfb97e3a in mysql_parse (thd=thd@entry=0x152008000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x15203d10f470) at /test/10.10_dbg/sql/sql_parse.cc:8036
#18 0x00005576cfba5422 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x152008000db8, packet=packet@entry=0x15200800b6d9 "SELECT * FROM c AS c WHERE c IS NULL OR c<0 / TRUE * 0 WINDOW c AS(PARTITION BY c AND -0 BETWEEN(SELECT * FROM c GROUP BY c HAVING ((c=c AND c BETWEEN 0 AND 0)) WINDOW c AS(PARTITION BY c)) AND -0)", packet_length=packet_length@entry=197, blocking=blocking@entry=true) at /test/10.10_dbg/sql/sql_class.h:1364
#19 0x00005576cfba7b2c in do_command (thd=0x152008000db8, blocking=blocking@entry=true) at /test/10.10_dbg/sql/sql_parse.cc:1407
#20 0x00005576cfd073c0 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5576d2fc9ef8, put_in_cache=put_in_cache@entry=true) at /test/10.10_dbg/sql/sql_connect.cc:1418
#21 0x00005576cfd078c9 in handle_one_connection (arg=0x5576d2fc9ef8) at /test/10.10_dbg/sql/sql_connect.cc:1312
#22 0x0000152055fb5609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#23 0x0000152055ba1133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Roel Van de Paar
added a comment - - edited Secondary testcase with slightly different stack
CREATE TABLE c(c DEC ) ENGINE=InnoDB;
SELECT * FROM c AS c WHERE c IS NULL OR c<0 / TRUE * 0 WINDOW c AS (PARTITION BY c AND -0 BETWEEN ( SELECT * FROM c GROUP BY c HAVING ((c=c AND c BETWEEN 0 AND 0)) WINDOW c AS (PARTITION BY c)) AND -0);
Leads to:
10.10.0 081a284712bb661349e2e3802077b12211cede3e (Debug)
Core was generated by `/test/MD310522-mariadb-10.10.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 Bitmap<64u>::merge (map2=..., this=<optimized out>)
at /test/10.10_dbg/sql/sql_bitmap.h:210
[Current thread is 1 (Thread 0x15203d110700 (LWP 3408256))]
(gdb) bt
#0 Bitmap<64u>::merge (map2=<optimized out>, this=<optimized out>) at /test/10.10_dbg/sql/sql_bitmap.h:210
#1 add_key_field (join=join@entry=0x152008025860, key_fields=key_fields@entry=0x15203d10e408, and_level=and_level@entry=0, cond=cond@entry=0x152008016a28, field=field@entry=0x152008029d48, eq_func=eq_func@entry=true, value=0x152008016b60, num_values=1, usable_tables=18446744073709551615, sargables=0x15203d10e528, row_col_no=0) at /test/10.10_dbg/sql/sql_select.cc:6304
#2 0x00005576cfbe80ca in add_key_equal_fields (join=join@entry=0x152008025860, key_fields=key_fields@entry=0x15203d10e408, and_level=0, cond=cond@entry=0x152008016a28, field_item=0x152008025060, eq_func=eq_func@entry=true, val=0x152008016b60, num_values=1, usable_tables=18446744073709551615, sargables=0x15203d10e528, row_col_no=0) at /test/10.10_dbg/sql/sql_select.cc:6421
#3 0x00005576cfbf17a7 in Item_func_between::add_key_fields (this=0x152008016a28, join=0x152008025860, key_fields=0x15203d10e408, and_level=0x15203d10e404, usable_tables=18446744073709551615, sargables=0x15203d10e528) at /test/10.10_dbg/sql/sql_select.cc:6587
#4 0x00005576cfbf12da in Item_cond_and::add_key_fields (this=<optimized out>, join=0x152008025860, key_fields=0x15203d10e408, and_level=0x15203d10e404, usable_tables=18446744073709551615, sargables=0x15203d10e528) at /test/10.10_dbg/sql/sql_select.cc:6496
#5 0x00005576cfbf22a8 in update_ref_and_keys (thd=thd@entry=0x152008000db8, keyuse=keyuse@entry=0x152008025b80, join_tab=0x152008026728, tables=1, cond=0x152008026610, normal_tables=normal_tables@entry=18446744073709551615, select_lex=0x152008015598, sargables=0x15203d10e528) at /test/10.10_dbg/sql/sql_select.cc:7178
#6 0x00005576cfc28668 in make_join_statistics (join=join@entry=0x152008025860, tables_list=@0x1520080157b0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x152008025e18, last = 0x152008025e18, elements = 1}, <No data fields>}, keyuse_array=keyuse_array@entry=0x152008025b80) at /test/10.10_dbg/sql/sql_select.cc:5430
#7 0x00005576cfc31012 in JOIN::optimize_inner (this=this@entry=0x152008025860) at /test/10.10_dbg/sql/sql_select.cc:2503
#8 0x00005576cfc31452 in JOIN::optimize (this=this@entry=0x152008025860) at /test/10.10_dbg/sql/sql_select.cc:1845
#9 0x00005576cfb75a24 in st_select_lex::optimize_unflattened_subqueries (this=0x152008013e18, const_only=const_only@entry=true) at /test/10.10_dbg/sql/sql_lex.cc:4916
#10 0x00005576cfd646a1 in JOIN::optimize_constant_subqueries (this=this@entry=0x152008024a98) at /test/10.10_dbg/sql/opt_subselect.cc:5622
#11 0x00005576cfc2ff76 in JOIN::optimize_inner (this=this@entry=0x152008024a98) at /test/10.10_dbg/sql/sql_select.cc:2165
#12 0x00005576cfc31452 in JOIN::optimize (this=this@entry=0x152008024a98) at /test/10.10_dbg/sql/sql_select.cc:1845
#13 0x00005576cfc31545 in mysql_select (thd=thd@entry=0x152008000db8, tables=0x152008014400, fields=@0x1520080140b8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x1520080143a8, last = 0x1520080143a8, elements = 1}, <No data fields>}, conds=0x1520080152f0, og_num=1, order=0x0, group=0x152008016390, having=0x0, proc_param=0x0, select_options=2147748608, result=0x152008024a70, unit=0x152008004fd8, select_lex=0x152008013e18) at /test/10.10_dbg/sql/sql_select.cc:5030
#14 0x00005576cfc31d8e in handle_select (thd=thd@entry=0x152008000db8, lex=lex@entry=0x152008004f00, result=result@entry=0x152008024a70, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.10_dbg/sql/sql_select.cc:578
#15 0x00005576cfb9db5e in execute_sqlcom_select (thd=thd@entry=0x152008000db8, all_tables=0x152008014400) at /test/10.10_dbg/sql/sql_parse.cc:6260
#16 0x00005576cfba9e70 in mysql_execute_command (thd=thd@entry=0x152008000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.10_dbg/sql/sql_parse.cc:3944
#17 0x00005576cfb97e3a in mysql_parse (thd=thd@entry=0x152008000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x15203d10f470) at /test/10.10_dbg/sql/sql_parse.cc:8036
#18 0x00005576cfba5422 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x152008000db8, packet=packet@entry=0x15200800b6d9 "SELECT * FROM c AS c WHERE c IS NULL OR c<0 / TRUE * 0 WINDOW c AS(PARTITION BY c AND -0 BETWEEN(SELECT * FROM c GROUP BY c HAVING ((c=c AND c BETWEEN 0 AND 0)) WINDOW c AS(PARTITION BY c)) AND -0)", packet_length=packet_length@entry=197, blocking=blocking@entry=true) at /test/10.10_dbg/sql/sql_class.h:1364
#19 0x00005576cfba7b2c in do_command (thd=0x152008000db8, blocking=blocking@entry=true) at /test/10.10_dbg/sql/sql_parse.cc:1407
#20 0x00005576cfd073c0 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5576d2fc9ef8, put_in_cache=put_in_cache@entry=true) at /test/10.10_dbg/sql/sql_connect.cc:1418
#21 0x00005576cfd078c9 in handle_one_connection (arg=0x5576d2fc9ef8) at /test/10.10_dbg/sql/sql_connect.cc:1312
#22 0x0000152055fb5609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#23 0x0000152055ba1133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Bug confirmed present in:
MariaDB: 10.4.26 (dbg), 10.4.26 (opt), 10.5.17 (dbg), 10.5.17 (opt), 10.6.9 (dbg), 10.6.9 (opt), 10.7.5 (dbg), 10.7.5 (opt), 10.8.4 (dbg), 10.8.4 (opt), 10.9.2 (dbg), 10.9.2 (opt), 10.10.0 (dbg), 10.10.0 (opt)
Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.3.36 (dbg), 10.3.36 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.38 (dbg), 5.7.38 (opt), 8.0.29 (dbg), 8.0.29 (opt)
#2 0x0000558bf8692133 in add_key_equal_fields (join=join@entry=0x14b2f406ed18, key_fields=key_fields@entry=0x14b3540582d8, and_level=0, cond=cond@entry=0x14b2f4015e38, field_item=0x14b2f40176f8, eq_func=eq_func@entry=true, val=0x14b2f4015eb8, num_values=1, usable_tables=18446744073709551615, sargables=0x14b3540583f8, row_col_no=0) at /test/10.11_dbg/sql/sql_select.cc:6473
#3 0x0000558bf869bc95 in Item_bool_func2::add_key_fields_optimize_op (this=0x14b2f4015e38, join=0x14b2f406ed18, key_fields=0x14b3540582d8, and_level=0x14b3540582d4, usable_tables=18446744073709551615, sargables=0x14b3540583f8, equal_func=true) at /test/10.11_dbg/sql/sql_select.cc:6750
#4 0x0000558bf899dd5d in Item_func_eq::add_key_fields (this=<optimized out>, join=<optimized out>, key_fields=<optimized out>, and_level=<optimized out>, usable_tables=<optimized out>, sargables=<optimized out>) at /test/10.11_dbg/sql/item_cmpfunc.h:775
#5 0x0000558bf869c2d0 in update_ref_and_keys (thd=thd@entry=0x14b2f4000db8, keyuse=keyuse@entry=0x14b2f406f068, join_tab=0x14b2f406fa38, tables=1, cond=0x14b2f4015e38, normal_tables=normal_tables@entry=18446744073709551615, select_lex=0x14b2f4014e60, sargables=0x14b3540583f8) at /test/10.11_dbg/sql/sql_select.cc:7230
#6 0x0000558bf86d3c93 in make_join_statistics (join=join@entry=0x14b2f406ed18, tables_list=@0x14b2f4015078: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14b2f4017b48, last = 0x14b2f4017b48, elements = 1}, <No data fields>}, keyuse_array=keyuse_array@entry=0x14b2f406f068) at /test/10.11_dbg/sql/sql_select.cc:5478
#7 0x0000558bf86dc626 in JOIN::optimize_inner (this=this@entry=0x14b2f406ed18) at /test/10.11_dbg/sql/sql_select.cc:2524
#8 0x0000558bf86dca66 in JOIN::optimize (this=this@entry=0x14b2f406ed18) at /test/10.11_dbg/sql/sql_select.cc:1863
#9 0x0000558bf861f3f0 in st_select_lex::optimize_unflattened_subqueries (this=0x14b2f4013d98, const_only=const_only@entry=true) at /test/10.11_dbg/sql/sql_lex.cc:4915
#10 0x0000558bf88109c1 in JOIN::optimize_constant_subqueries (this=this@entry=0x14b2f406e730) at /test/10.11_dbg/sql/opt_subselect.cc:5689
#11 0x0000558bf86db58a in JOIN::optimize_inner (this=this@entry=0x14b2f406e730) at /test/10.11_dbg/sql/sql_select.cc:2186
#12 0x0000558bf86dca66 in JOIN::optimize (this=this@entry=0x14b2f406e730) at /test/10.11_dbg/sql/sql_select.cc:1863
#13 0x0000558bf86dcb59 in mysql_select (thd=thd@entry=0x14b2f4000db8, tables=0x14b2f4014380, fields=@0x14b2f4014038: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14b2f4014328, last = 0x14b2f4014328, elements = 1}, <No data fields>}, conds=0x14b2f4014c20, og_num=1, order=0x0, group=0x14b2f4015c58, having=0x0, proc_param=0x0, select_options=2164525824, result=0x14b2f40176c0, unit=0x14b2f4004ff0, select_lex=0x14b2f4013d98) at /test/10.11_dbg/sql/sql_select.cc:5056
#14 0x0000558bf86dd3a2 in handle_select (thd=thd@entry=0x14b2f4000db8, lex=lex@entry=0x14b2f4004f18, result=result@entry=0x14b2f40176c0, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.11_dbg/sql/sql_select.cc:581
#15 0x0000558bf86475a6 in execute_sqlcom_select (thd=thd@entry=0x14b2f4000db8, all_tables=0x14b2f4014380) at /test/10.11_dbg/sql/sql_parse.cc:6261
#16 0x0000558bf86538c7 in mysql_execute_command (thd=thd@entry=0x14b2f4000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.11_dbg/sql/sql_parse.cc:3945
#17 0x0000558bf8641882 in mysql_parse (thd=thd@entry=0x14b2f4000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14b354059330) at /test/10.11_dbg/sql/sql_parse.cc:8035
#18 0x0000558bf864ee6a in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14b2f4000db8, packet=packet@entry=0x14b2f400b6e9 "SELECT * FROM c AS c WHERE c=1 WINDOW c AS (ORDER BY (SELECT * FROM c GROUP BY c HAVING c=1 WINDOW c AS (PARTITION BY c)))", packet_length=packet_length@entry=122, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_class.h:1339
#19 0x0000558bf8651574 in do_command (thd=0x14b2f4000db8, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_parse.cc:1407
#20 0x0000558bf87b31da in do_handle_one_connection (connect=<optimized out>, connect@entry=0x558bfb169118, put_in_cache=put_in_cache@entry=true) at /test/10.11_dbg/sql/sql_connect.cc:1418
#21 0x0000558bf87b36e3 in handle_one_connection (arg=0x558bfb169118) at /test/10.11_dbg/sql/sql_connect.cc:1312
#22 0x000014b36b4e6609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#23 0x000014b36b0d2133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Roel Van de Paar
added a comment - Additional stack with this testcase
CREATE TABLE c (c DEC ) ENGINE=InnoDB;
SELECT * FROM c AS c WHERE c=1 WINDOW c AS ( ORDER BY ( SELECT * FROM c GROUP BY c HAVING c=1 WINDOW c AS (PARTITION BY c)));
Leads to:
10.11.0 bc563f1a4b0b38de3b41fd0f0d3d8b7f1aacbd8b (Debug)
Core was generated by `/test/MD190822-mariadb-10.11.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 Bitmap<64u>::merge (map2=..., this=<optimized out>)
at /test/10.11_dbg/sql/sql_bitmap.h:210
[Current thread is 1 (Thread 0x14b35405a700 (LWP 2059048))]
(gdb) bt
#0 Bitmap<64u>::merge (map2=<optimized out>, this=<optimized out>) at /test/10.11_dbg/sql/sql_bitmap.h:210
#1 add_key_field (join=join@entry=0x14b2f406ed18, key_fields=key_fields@entry=0x14b3540582d8, and_level=and_level@entry=0, cond=cond@entry=0x14b2f4015e38, field=field@entry=0x14b2f40258a8, eq_func=eq_func@entry=true, value=0x14b2f4015eb8, num_values=1, usable_tables=18446744073709551615, sargables=0x14b3540583f8, row_col_no=0) at /test/10.11_dbg/sql/sql_select.cc:6352
#2 0x0000558bf8692133 in add_key_equal_fields (join=join@entry=0x14b2f406ed18, key_fields=key_fields@entry=0x14b3540582d8, and_level=0, cond=cond@entry=0x14b2f4015e38, field_item=0x14b2f40176f8, eq_func=eq_func@entry=true, val=0x14b2f4015eb8, num_values=1, usable_tables=18446744073709551615, sargables=0x14b3540583f8, row_col_no=0) at /test/10.11_dbg/sql/sql_select.cc:6473
#3 0x0000558bf869bc95 in Item_bool_func2::add_key_fields_optimize_op (this=0x14b2f4015e38, join=0x14b2f406ed18, key_fields=0x14b3540582d8, and_level=0x14b3540582d4, usable_tables=18446744073709551615, sargables=0x14b3540583f8, equal_func=true) at /test/10.11_dbg/sql/sql_select.cc:6750
#4 0x0000558bf899dd5d in Item_func_eq::add_key_fields (this=<optimized out>, join=<optimized out>, key_fields=<optimized out>, and_level=<optimized out>, usable_tables=<optimized out>, sargables=<optimized out>) at /test/10.11_dbg/sql/item_cmpfunc.h:775
#5 0x0000558bf869c2d0 in update_ref_and_keys (thd=thd@entry=0x14b2f4000db8, keyuse=keyuse@entry=0x14b2f406f068, join_tab=0x14b2f406fa38, tables=1, cond=0x14b2f4015e38, normal_tables=normal_tables@entry=18446744073709551615, select_lex=0x14b2f4014e60, sargables=0x14b3540583f8) at /test/10.11_dbg/sql/sql_select.cc:7230
#6 0x0000558bf86d3c93 in make_join_statistics (join=join@entry=0x14b2f406ed18, tables_list=@0x14b2f4015078: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14b2f4017b48, last = 0x14b2f4017b48, elements = 1}, <No data fields>}, keyuse_array=keyuse_array@entry=0x14b2f406f068) at /test/10.11_dbg/sql/sql_select.cc:5478
#7 0x0000558bf86dc626 in JOIN::optimize_inner (this=this@entry=0x14b2f406ed18) at /test/10.11_dbg/sql/sql_select.cc:2524
#8 0x0000558bf86dca66 in JOIN::optimize (this=this@entry=0x14b2f406ed18) at /test/10.11_dbg/sql/sql_select.cc:1863
#9 0x0000558bf861f3f0 in st_select_lex::optimize_unflattened_subqueries (this=0x14b2f4013d98, const_only=const_only@entry=true) at /test/10.11_dbg/sql/sql_lex.cc:4915
#10 0x0000558bf88109c1 in JOIN::optimize_constant_subqueries (this=this@entry=0x14b2f406e730) at /test/10.11_dbg/sql/opt_subselect.cc:5689
#11 0x0000558bf86db58a in JOIN::optimize_inner (this=this@entry=0x14b2f406e730) at /test/10.11_dbg/sql/sql_select.cc:2186
#12 0x0000558bf86dca66 in JOIN::optimize (this=this@entry=0x14b2f406e730) at /test/10.11_dbg/sql/sql_select.cc:1863
#13 0x0000558bf86dcb59 in mysql_select (thd=thd@entry=0x14b2f4000db8, tables=0x14b2f4014380, fields=@0x14b2f4014038: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14b2f4014328, last = 0x14b2f4014328, elements = 1}, <No data fields>}, conds=0x14b2f4014c20, og_num=1, order=0x0, group=0x14b2f4015c58, having=0x0, proc_param=0x0, select_options=2164525824, result=0x14b2f40176c0, unit=0x14b2f4004ff0, select_lex=0x14b2f4013d98) at /test/10.11_dbg/sql/sql_select.cc:5056
#14 0x0000558bf86dd3a2 in handle_select (thd=thd@entry=0x14b2f4000db8, lex=lex@entry=0x14b2f4004f18, result=result@entry=0x14b2f40176c0, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.11_dbg/sql/sql_select.cc:581
#15 0x0000558bf86475a6 in execute_sqlcom_select (thd=thd@entry=0x14b2f4000db8, all_tables=0x14b2f4014380) at /test/10.11_dbg/sql/sql_parse.cc:6261
#16 0x0000558bf86538c7 in mysql_execute_command (thd=thd@entry=0x14b2f4000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.11_dbg/sql/sql_parse.cc:3945
#17 0x0000558bf8641882 in mysql_parse (thd=thd@entry=0x14b2f4000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14b354059330) at /test/10.11_dbg/sql/sql_parse.cc:8035
#18 0x0000558bf864ee6a in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14b2f4000db8, packet=packet@entry=0x14b2f400b6e9 "SELECT * FROM c AS c WHERE c=1 WINDOW c AS (ORDER BY (SELECT * FROM c GROUP BY c HAVING c=1 WINDOW c AS (PARTITION BY c)))", packet_length=packet_length@entry=122, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_class.h:1339
#19 0x0000558bf8651574 in do_command (thd=0x14b2f4000db8, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_parse.cc:1407
#20 0x0000558bf87b31da in do_handle_one_connection (connect=<optimized out>, connect@entry=0x558bfb169118, put_in_cache=put_in_cache@entry=true) at /test/10.11_dbg/sql/sql_connect.cc:1418
#21 0x0000558bf87b36e3 in handle_one_connection (arg=0x558bfb169118) at /test/10.11_dbg/sql/sql_connect.cc:1312
#22 0x000014b36b4e6609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#23 0x000014b36b0d2133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Bug confirmed present in:
MariaDB: 10.4.27 (dbg), 10.5.18 (dbg), 10.5.18 (opt), 10.6.10 (dbg), 10.6.10 (opt), 10.7.6 (dbg), 10.7.6 (opt), 10.8.5 (dbg), 10.8.5 (opt), 10.9.2 (dbg), 10.9.2 (opt), 10.10.2 (dbg), 10.10.2 (opt), 10.11.0 (dbg), 10.11.0 (opt)
Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.3.37 (dbg), 10.3.37 (opt), 10.4.27 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.38 (dbg), 5.7.38 (opt), 8.0.29 (dbg), 8.0.29 (opt)
#2 0x000055aeb10befb3 in Item_equal::add_key_fields (this=0x151de0068ce8, join=0x151de0067e08, key_fields=0x151e170fa2a8, and_level=0x151e170fa2a4, usable_tables=18446744073709551615, sargables=0x151e170fa3c8) at /test/10.11_dbg/sql/sql_select.cc:6811
#3 0x000055aeb10bf352 in update_ref_and_keys (thd=thd@entry=0x151de0000d48, keyuse=keyuse@entry=0x151de0068158, join_tab=0x151de0068e68, tables=1, cond=0x151de0068ce8, normal_tables=normal_tables@entry=18446744073709551615, select_lex=0x151de0014378, sargables=0x151e170fa3c8) at /test/10.11_dbg/sql/sql_select.cc:7240
#4 0x000055aeb10f5a4d in make_join_statistics (join=join@entry=0x151de0067e08, tables_list=@0x151de0014590: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x151de0016fb0, last = 0x151de0016fb0, elements = 1}, <No data fields>}, keyuse_array=keyuse_array@entry=0x151de0068158) at /test/10.11_dbg/sql/sql_select.cc:5488
#5 0x000055aeb10fe155 in JOIN::optimize_inner (this=this@entry=0x151de0067e08) at /test/10.11_dbg/sql/sql_select.cc:2534
#6 0x000055aeb10fe577 in JOIN::optimize (this=this@entry=0x151de0067e08) at /test/10.11_dbg/sql/sql_select.cc:1870
#7 0x000055aeb1045ec0 in st_select_lex::optimize_unflattened_subqueries (this=0x151de0013278, const_only=const_only@entry=true) at /test/10.11_dbg/sql/sql_lex.cc:4907
#8 0x000055aeb122d50f in JOIN::optimize_constant_subqueries (this=this@entry=0x151de00675f0) at /test/10.11_dbg/sql/opt_subselect.cc:5689
#9 0x000055aeb10fd1fa in JOIN::optimize_inner (this=this@entry=0x151de00675f0) at /test/10.11_dbg/sql/sql_select.cc:2193
#10 0x000055aeb10fe577 in JOIN::optimize (this=this@entry=0x151de00675f0) at /test/10.11_dbg/sql/sql_select.cc:1870
#11 0x000055aeb10fe667 in mysql_select (thd=thd@entry=0x151de0000d48, tables=0x151de0013868, fields=@0x151de0013518: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x151de0013810, last = 0x151de0013810, elements = 1}, <No data fields>}, conds=0x151de0014138, og_num=1, order=0x0, group=0x151de00151a8, having=0x0, proc_param=0x0, select_options=2164525824, result=0x151de0016c70, unit=0x151de0004f88, select_lex=0x151de0013278) at /test/10.11_dbg/sql/sql_select.cc:5066
#12 0x000055aeb10fee2d in handle_select (thd=thd@entry=0x151de0000d48, lex=lex@entry=0x151de0004eb0, result=result@entry=0x151de0016c70, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.11_dbg/sql/sql_select.cc:581
#13 0x000055aeb106c36d in execute_sqlcom_select (thd=thd@entry=0x151de0000d48, all_tables=0x151de0013868) at /test/10.11_dbg/sql/sql_parse.cc:6265
#14 0x000055aeb10784a2 in mysql_execute_command (thd=thd@entry=0x151de0000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.11_dbg/sql/sql_parse.cc:3949
#15 0x000055aeb10667f4 in mysql_parse (thd=thd@entry=0x151de0000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x151e170fb300) at /test/10.11_dbg/sql/sql_parse.cc:8000
#16 0x000055aeb1073d2f in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x151de0000d48, packet=packet@entry=0x151de000adf9 "SELECT * FROM c AS c WHERE c=1 WINDOW c AS (ORDER BY (SELECT * FROM c GROUP BY c HAVING c=1 WINDOW c AS (PARTITION BY c)))", packet_length=packet_length@entry=122, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_class.h:1346
#17 0x000055aeb107616d in do_command (thd=0x151de0000d48, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_parse.cc:1407
#18 0x000055aeb11d1013 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55aeb477b618, put_in_cache=put_in_cache@entry=true) at /test/10.11_dbg/sql/sql_connect.cc:1416
#19 0x000055aeb11d14e2 in handle_one_connection (arg=0x55aeb477b618) at /test/10.11_dbg/sql/sql_connect.cc:1318
#20 0x0000151e3c592609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#21 0x0000151e3c17e133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
10.4-10.11 dbg+opt affected.
Roel Van de Paar
added a comment - Additional testcase. Crashes irrespective of InnoDB or MyISAM being used. Produces slightly different stack.
CREATE TABLE c (c INT );
SELECT * FROM c AS c WHERE c=1 WINDOW c AS ( ORDER BY ( SELECT * FROM c GROUP BY c HAVING c=1 WINDOW c AS (PARTITION BY c)));
Leads to:
10.11.2 c194db34d93d8d94bd52b17349063fa401e3f942 (Debug)
Core was generated by `/test/MD171222-mariadb-10.11.2-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 Bitmap<64u>::merge (map2=..., this=<optimized out>)
at /test/10.11_dbg/sql/sql_bitmap.h:210
210 for (size_t i= 0; i < ARRAY_ELEMENTS; i++)
[Current thread is 1 (Thread 0x151e170fc700 (LWP 3685023))]
(gdb) bt
#0 Bitmap<64u>::merge (map2=<optimized out>, this=<optimized out>) at /test/10.11_dbg/sql/sql_bitmap.h:210
#1 add_key_field (join=join@entry=0x151de0067e08, key_fields=key_fields@entry=0x151e170fa2a8, and_level=0, cond=cond@entry=0x151de0068ce8, field=0x151de0023a28, eq_func=eq_func@entry=true, value=0x151e170fa210, num_values=1, usable_tables=18446744073709551615, sargables=0x151e170fa3c8, row_col_no=0) at /test/10.11_dbg/sql/sql_select.cc:6362
#2 0x000055aeb10befb3 in Item_equal::add_key_fields (this=0x151de0068ce8, join=0x151de0067e08, key_fields=0x151e170fa2a8, and_level=0x151e170fa2a4, usable_tables=18446744073709551615, sargables=0x151e170fa3c8) at /test/10.11_dbg/sql/sql_select.cc:6811
#3 0x000055aeb10bf352 in update_ref_and_keys (thd=thd@entry=0x151de0000d48, keyuse=keyuse@entry=0x151de0068158, join_tab=0x151de0068e68, tables=1, cond=0x151de0068ce8, normal_tables=normal_tables@entry=18446744073709551615, select_lex=0x151de0014378, sargables=0x151e170fa3c8) at /test/10.11_dbg/sql/sql_select.cc:7240
#4 0x000055aeb10f5a4d in make_join_statistics (join=join@entry=0x151de0067e08, tables_list=@0x151de0014590: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x151de0016fb0, last = 0x151de0016fb0, elements = 1}, <No data fields>}, keyuse_array=keyuse_array@entry=0x151de0068158) at /test/10.11_dbg/sql/sql_select.cc:5488
#5 0x000055aeb10fe155 in JOIN::optimize_inner (this=this@entry=0x151de0067e08) at /test/10.11_dbg/sql/sql_select.cc:2534
#6 0x000055aeb10fe577 in JOIN::optimize (this=this@entry=0x151de0067e08) at /test/10.11_dbg/sql/sql_select.cc:1870
#7 0x000055aeb1045ec0 in st_select_lex::optimize_unflattened_subqueries (this=0x151de0013278, const_only=const_only@entry=true) at /test/10.11_dbg/sql/sql_lex.cc:4907
#8 0x000055aeb122d50f in JOIN::optimize_constant_subqueries (this=this@entry=0x151de00675f0) at /test/10.11_dbg/sql/opt_subselect.cc:5689
#9 0x000055aeb10fd1fa in JOIN::optimize_inner (this=this@entry=0x151de00675f0) at /test/10.11_dbg/sql/sql_select.cc:2193
#10 0x000055aeb10fe577 in JOIN::optimize (this=this@entry=0x151de00675f0) at /test/10.11_dbg/sql/sql_select.cc:1870
#11 0x000055aeb10fe667 in mysql_select (thd=thd@entry=0x151de0000d48, tables=0x151de0013868, fields=@0x151de0013518: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x151de0013810, last = 0x151de0013810, elements = 1}, <No data fields>}, conds=0x151de0014138, og_num=1, order=0x0, group=0x151de00151a8, having=0x0, proc_param=0x0, select_options=2164525824, result=0x151de0016c70, unit=0x151de0004f88, select_lex=0x151de0013278) at /test/10.11_dbg/sql/sql_select.cc:5066
#12 0x000055aeb10fee2d in handle_select (thd=thd@entry=0x151de0000d48, lex=lex@entry=0x151de0004eb0, result=result@entry=0x151de0016c70, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.11_dbg/sql/sql_select.cc:581
#13 0x000055aeb106c36d in execute_sqlcom_select (thd=thd@entry=0x151de0000d48, all_tables=0x151de0013868) at /test/10.11_dbg/sql/sql_parse.cc:6265
#14 0x000055aeb10784a2 in mysql_execute_command (thd=thd@entry=0x151de0000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.11_dbg/sql/sql_parse.cc:3949
#15 0x000055aeb10667f4 in mysql_parse (thd=thd@entry=0x151de0000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x151e170fb300) at /test/10.11_dbg/sql/sql_parse.cc:8000
#16 0x000055aeb1073d2f in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x151de0000d48, packet=packet@entry=0x151de000adf9 "SELECT * FROM c AS c WHERE c=1 WINDOW c AS (ORDER BY (SELECT * FROM c GROUP BY c HAVING c=1 WINDOW c AS (PARTITION BY c)))", packet_length=packet_length@entry=122, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_class.h:1346
#17 0x000055aeb107616d in do_command (thd=0x151de0000d48, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_parse.cc:1407
#18 0x000055aeb11d1013 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55aeb477b618, put_in_cache=put_in_cache@entry=true) at /test/10.11_dbg/sql/sql_connect.cc:1416
#19 0x000055aeb11d14e2 in handle_one_connection (arg=0x55aeb477b618) at /test/10.11_dbg/sql/sql_connect.cc:1318
#20 0x0000151e3c592609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#21 0x0000151e3c17e133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
10.4-10.11 dbg+opt affected.
People
Sergei Petrunia
Roel Van de Paar
Votes:
0Vote for this issue
Watchers:
2Start watching this issue
Dates
Created:
Updated:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":1179.9000000953674,"ttfb":300.69999980926514,"pageVisibility":"visible","entityId":112438,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"2111fb97-bac3-4608-8e74-345b27587427","navigationType":0,"readyForUser":1256.8000001907349,"redirectCount":0,"resourceLoadedEnd":1314,"resourceLoadedStart":334.09999990463257,"resourceTiming":[{"duration":114.7000002861023,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":334.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":334.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":448.80000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":115.69999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":334.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":334.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":450,"responseStart":0,"secureConnectionStart":0},{"duration":177.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":334.5,"connectEnd":334.5,"connectStart":334.5,"domainLookupEnd":334.5,"domainLookupStart":334.5,"fetchStart":334.5,"redirectEnd":0,"redirectStart":0,"requestStart":334.5,"responseEnd":511.59999990463257,"responseStart":511.59999990463257,"secureConnectionStart":334.5},{"duration":233,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":334.59999990463257,"connectEnd":334.59999990463257,"connectStart":334.59999990463257,"domainLookupEnd":334.59999990463257,"domainLookupStart":334.59999990463257,"fetchStart":334.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":334.59999990463257,"responseEnd":567.5999999046326,"responseStart":567.5999999046326,"secureConnectionStart":334.59999990463257},{"duration":250.89999961853027,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":334.80000019073486,"connectEnd":334.80000019073486,"connectStart":334.80000019073486,"domainLookupEnd":334.80000019073486,"domainLookupStart":334.80000019073486,"fetchStart":334.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":334.80000019073486,"responseEnd":585.6999998092651,"responseStart":585.6999998092651,"secureConnectionStart":334.80000019073486},{"duration":252.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":335.09999990463257,"connectEnd":335.09999990463257,"connectStart":335.09999990463257,"domainLookupEnd":335.09999990463257,"domainLookupStart":335.09999990463257,"fetchStart":335.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":335.09999990463257,"responseEnd":587.5999999046326,"responseStart":587.5999999046326,"secureConnectionStart":335.09999990463257},{"duration":252.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":335.19999980926514,"connectEnd":335.19999980926514,"connectStart":335.19999980926514,"domainLookupEnd":335.19999980926514,"domainLookupStart":335.19999980926514,"fetchStart":335.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":335.19999980926514,"responseEnd":588.0999999046326,"responseStart":588.0999999046326,"secureConnectionStart":335.19999980926514},{"duration":399.8999996185303,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":335.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":335.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":735.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":253,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":335.5,"connectEnd":335.5,"connectStart":335.5,"domainLookupEnd":335.5,"domainLookupStart":335.5,"fetchStart":335.5,"redirectEnd":0,"redirectStart":0,"requestStart":335.5,"responseEnd":588.5,"responseStart":588.5,"secureConnectionStart":335.5},{"duration":399.80000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":335.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":335.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":735.5,"responseStart":0,"secureConnectionStart":0},{"duration":254.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":335.90000009536743,"connectEnd":335.90000009536743,"connectStart":335.90000009536743,"domainLookupEnd":335.90000009536743,"domainLookupStart":335.90000009536743,"fetchStart":335.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":335.90000009536743,"responseEnd":590,"responseStart":590,"secureConnectionStart":335.90000009536743},{"duration":833.8999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":336.80000019073486,"connectEnd":336.80000019073486,"connectStart":336.80000019073486,"domainLookupEnd":336.80000019073486,"domainLookupStart":336.80000019073486,"fetchStart":336.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":336.80000019073486,"responseEnd":1170.6999998092651,"responseStart":1170.6999998092651,"secureConnectionStart":336.80000019073486},{"duration":945.8000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":368.19999980926514,"connectEnd":368.19999980926514,"connectStart":368.19999980926514,"domainLookupEnd":368.19999980926514,"domainLookupStart":368.19999980926514,"fetchStart":368.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":368.19999980926514,"responseEnd":1314,"responseStart":1314,"secureConnectionStart":368.19999980926514},{"duration":388.19999980926514,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":783,"connectEnd":783,"connectStart":783,"domainLookupEnd":783,"domainLookupStart":783,"fetchStart":783,"redirectEnd":0,"redirectStart":0,"requestStart":783,"responseEnd":1171.1999998092651,"responseStart":1171.1999998092651,"secureConnectionStart":783},{"duration":349.3999996185303,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1110.3000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1110.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1459.6999998092651,"responseStart":0,"secureConnectionStart":0}],"fetchStart":1,"domainLookupStart":1,"domainLookupEnd":1,"connectStart":1,"connectEnd":1,"requestStart":114,"responseStart":301,"responseEnd":379,"domLoading":323,"domInteractive":1508,"domContentLoadedEventStart":1508,"domContentLoadedEventEnd":1571,"domComplete":1849,"loadEventStart":1850,"loadEventEnd":1850,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1468.4000000953674},{"name":"bigPipe.sidebar-id.end","time":1469.3000001907349},{"name":"bigPipe.activity-panel-pipe-id.start","time":1469.5999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":1475.4000000953674},{"name":"activityTabFullyLoaded","time":1594.8000001907349}],"measures":[],"correlationId":"c979c5bc0e76ee","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":121,"dbReadsTimeInMs":15,"dbConnsTimeInMs":24,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Secondary testcase with slightly different stack
Leads to:
10.10.0 081a284712bb661349e2e3802077b12211cede3e (Debug)
Core was generated by `/test/MD310522-mariadb-10.10.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 Bitmap<64u>::merge (map2=..., this=<optimized out>)
at /test/10.10_dbg/sql/sql_bitmap.h:210
[Current thread is 1 (Thread 0x15203d110700 (LWP 3408256))]
(gdb) bt
#0 Bitmap<64u>::merge (map2=<optimized out>, this=<optimized out>) at /test/10.10_dbg/sql/sql_bitmap.h:210
#1 add_key_field (join=join@entry=0x152008025860, key_fields=key_fields@entry=0x15203d10e408, and_level=and_level@entry=0, cond=cond@entry=0x152008016a28, field=field@entry=0x152008029d48, eq_func=eq_func@entry=true, value=0x152008016b60, num_values=1, usable_tables=18446744073709551615, sargables=0x15203d10e528, row_col_no=0) at /test/10.10_dbg/sql/sql_select.cc:6304
#2 0x00005576cfbe80ca in add_key_equal_fields (join=join@entry=0x152008025860, key_fields=key_fields@entry=0x15203d10e408, and_level=0, cond=cond@entry=0x152008016a28, field_item=0x152008025060, eq_func=eq_func@entry=true, val=0x152008016b60, num_values=1, usable_tables=18446744073709551615, sargables=0x15203d10e528, row_col_no=0) at /test/10.10_dbg/sql/sql_select.cc:6421
#3 0x00005576cfbf17a7 in Item_func_between::add_key_fields (this=0x152008016a28, join=0x152008025860, key_fields=0x15203d10e408, and_level=0x15203d10e404, usable_tables=18446744073709551615, sargables=0x15203d10e528) at /test/10.10_dbg/sql/sql_select.cc:6587
#4 0x00005576cfbf12da in Item_cond_and::add_key_fields (this=<optimized out>, join=0x152008025860, key_fields=0x15203d10e408, and_level=0x15203d10e404, usable_tables=18446744073709551615, sargables=0x15203d10e528) at /test/10.10_dbg/sql/sql_select.cc:6496
#5 0x00005576cfbf22a8 in update_ref_and_keys (thd=thd@entry=0x152008000db8, keyuse=keyuse@entry=0x152008025b80, join_tab=0x152008026728, tables=1, cond=0x152008026610, normal_tables=normal_tables@entry=18446744073709551615, select_lex=0x152008015598, sargables=0x15203d10e528) at /test/10.10_dbg/sql/sql_select.cc:7178
#6 0x00005576cfc28668 in make_join_statistics (join=join@entry=0x152008025860, tables_list=@0x1520080157b0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x152008025e18, last = 0x152008025e18, elements = 1}, <No data fields>}, keyuse_array=keyuse_array@entry=0x152008025b80) at /test/10.10_dbg/sql/sql_select.cc:5430
#7 0x00005576cfc31012 in JOIN::optimize_inner (this=this@entry=0x152008025860) at /test/10.10_dbg/sql/sql_select.cc:2503
#8 0x00005576cfc31452 in JOIN::optimize (this=this@entry=0x152008025860) at /test/10.10_dbg/sql/sql_select.cc:1845
#9 0x00005576cfb75a24 in st_select_lex::optimize_unflattened_subqueries (this=0x152008013e18, const_only=const_only@entry=true) at /test/10.10_dbg/sql/sql_lex.cc:4916
#10 0x00005576cfd646a1 in JOIN::optimize_constant_subqueries (this=this@entry=0x152008024a98) at /test/10.10_dbg/sql/opt_subselect.cc:5622
#11 0x00005576cfc2ff76 in JOIN::optimize_inner (this=this@entry=0x152008024a98) at /test/10.10_dbg/sql/sql_select.cc:2165
#12 0x00005576cfc31452 in JOIN::optimize (this=this@entry=0x152008024a98) at /test/10.10_dbg/sql/sql_select.cc:1845
#13 0x00005576cfc31545 in mysql_select (thd=thd@entry=0x152008000db8, tables=0x152008014400, fields=@0x1520080140b8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x1520080143a8, last = 0x1520080143a8, elements = 1}, <No data fields>}, conds=0x1520080152f0, og_num=1, order=0x0, group=0x152008016390, having=0x0, proc_param=0x0, select_options=2147748608, result=0x152008024a70, unit=0x152008004fd8, select_lex=0x152008013e18) at /test/10.10_dbg/sql/sql_select.cc:5030
#14 0x00005576cfc31d8e in handle_select (thd=thd@entry=0x152008000db8, lex=lex@entry=0x152008004f00, result=result@entry=0x152008024a70, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.10_dbg/sql/sql_select.cc:578
#15 0x00005576cfb9db5e in execute_sqlcom_select (thd=thd@entry=0x152008000db8, all_tables=0x152008014400) at /test/10.10_dbg/sql/sql_parse.cc:6260
#16 0x00005576cfba9e70 in mysql_execute_command (thd=thd@entry=0x152008000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.10_dbg/sql/sql_parse.cc:3944
#17 0x00005576cfb97e3a in mysql_parse (thd=thd@entry=0x152008000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x15203d10f470) at /test/10.10_dbg/sql/sql_parse.cc:8036
#18 0x00005576cfba5422 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x152008000db8, packet=packet@entry=0x15200800b6d9 "SELECT * FROM c AS c WHERE c IS NULL OR c<0 / TRUE * 0 WINDOW c AS(PARTITION BY c AND -0 BETWEEN(SELECT * FROM c GROUP BY c HAVING ((c=c AND c BETWEEN 0 AND 0)) WINDOW c AS(PARTITION BY c)) AND -0)", packet_length=packet_length@entry=197, blocking=blocking@entry=true) at /test/10.10_dbg/sql/sql_class.h:1364
#19 0x00005576cfba7b2c in do_command (thd=0x152008000db8, blocking=blocking@entry=true) at /test/10.10_dbg/sql/sql_parse.cc:1407
#20 0x00005576cfd073c0 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5576d2fc9ef8, put_in_cache=put_in_cache@entry=true) at /test/10.10_dbg/sql/sql_connect.cc:1418
#21 0x00005576cfd078c9 in handle_one_connection (arg=0x5576d2fc9ef8) at /test/10.10_dbg/sql/sql_connect.cc:1312
#22 0x0000152055fb5609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#23 0x0000152055ba1133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Bug confirmed present in:
MariaDB: 10.4.26 (dbg), 10.4.26 (opt), 10.5.17 (dbg), 10.5.17 (opt), 10.6.9 (dbg), 10.6.9 (opt), 10.7.5 (dbg), 10.7.5 (opt), 10.8.4 (dbg), 10.8.4 (opt), 10.9.2 (dbg), 10.9.2 (opt), 10.10.0 (dbg), 10.10.0 (opt)
Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.3.36 (dbg), 10.3.36 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.38 (dbg), 5.7.38 (opt), 8.0.29 (dbg), 8.0.29 (opt)