[MDEV-10065] Server crashes in add_key_field / Bitmap<64u>::merge on execution of PS with CTE Created: 2016-05-13  Updated: 2016-09-04  Resolved: 2016-09-04

Status: Closed
Project: MariaDB Server
Component/s: Optimizer - CTE
Affects Version/s: 10.2
Fix Version/s: 10.2.2

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Igor Babaev
Resolution: Fixed Votes: 0
Labels: CTE


 Description   

Stack trace from 47a7c314ca44dbea2a91322c51a568680812e644

#3  <signal handler called>
#4  0x000055559513f7a2 in Bitmap<64u>::merge (this=0x1a8, map2=...) at /src/10.2/sql/sql_bitmap.h:196
#5  0x00005555951e112b in add_key_field (join=0x7fe0cc8677a0, key_fields=0x7fe0d83cfda8, and_level=0, cond=0x7fe0cc86b070, field=0x7fe0cc98e3a8, eq_func=true, value=0x7fe0cc86b100, num_values=1, usable_tables=18446744073709551615, sargables=0x7fe0d83cfe98) at /src/10.2/sql/sql_select.cc:4652
#6  0x00005555951e146a in add_key_equal_fields (join=0x7fe0cc8677a0, key_fields=0x7fe0d83cfda8, and_level=0, cond=0x7fe0cc86b070, field_item=0x7fe0cc9c9c98, eq_func=true, val=0x7fe0cc86b100, num_values=1, usable_tables=18446744073709551615, sargables=0x7fe0d83cfe98) at /src/10.2/sql/sql_select.cc:4762
#7  0x00005555951e2164 in Item_bool_func2::add_key_fields_optimize_op (this=0x7fe0cc86b070, join=0x7fe0cc8677a0, key_fields=0x7fe0d83cfda8, and_level=0x7fe0d83cfd98, usable_tables=18446744073709551615, sargables=0x7fe0d83cfe98, equal_func=true) at /src/10.2/sql/sql_select.cc:5027
#8  0x0000555595428449 in Item_func_eq::add_key_fields (this=0x7fe0cc86b070, join=0x7fe0cc8677a0, key_fields=0x7fe0d83cfda8, and_level=0x7fe0d83cfd98, usable_tables=18446744073709551615, sargables=0x7fe0d83cfe98) at /src/10.2/sql/item_cmpfunc.h:648
#9  0x00005555951e3745 in update_ref_and_keys (thd=0x7fe0cc82def0, keyuse=0x7fe0d83cfea0, join_tab=0x7fe0cc86a6a0, tables=1, cond=0x7fe0cc86b070, normal_tables=18446744073709551615, select_lex=0x7fe0cc9c85b0, sargables=0x7fe0d83cfe98) at /src/10.2/sql/sql_select.cc:5497
#10 0x000055559521342b in JOIN::reoptimize (this=0x7fe0cc8677a0, added_where=0x7fe0cc86b070, join_tables=1, save_to=0x0) at /src/10.2/sql/sql_select.cc:25179
#11 0x0000555595328112 in JOIN::choose_subquery_plan (this=0x7fe0cc8677a0, join_tables=1) at /src/10.2/sql/opt_subselect.cc:5689
#12 0x00005555951e05dd in make_join_statistics (join=0x7fe0cc8677a0, tables_list=..., keyuse_array=0x7fe0cc867a80) at /src/10.2/sql/sql_select.cc:4313
#13 0x00005555951d662d in JOIN::optimize_inner (this=0x7fe0cc8677a0) at /src/10.2/sql/sql_select.cc:1427
#14 0x00005555951d5414 in JOIN::optimize (this=0x7fe0cc8677a0) at /src/10.2/sql/sql_select.cc:1070
#15 0x000055559518a711 in st_select_lex::optimize_unflattened_subqueries (this=0x7fe0cc9c7000, const_only=false) at /src/10.2/sql/sql_lex.cc:3807
#16 0x0000555595548651 in mysql_delete (thd=0x7fe0cc82def0, table_list=0x7fe0cc9c7eb0, conds=0x7fe0cc90d4b0, order_list=0x7fe0cc9c7238, limit=18446744073709551615, options=0, result=0x0) at /src/10.2/sql/sql_delete.cc:311
#17 0x000055559519bca5 in mysql_execute_command (thd=0x7fe0cc82def0) at /src/10.2/sql/sql_parse.cc:4470
#18 0x00005555951c0d85 in Prepared_statement::execute (this=0x7fe0cc949070, expanded_query=0x7fe0d83d1d80, open_cursor=false) at /src/10.2/sql/sql_prepare.cc:4277
#19 0x00005555951bfc20 in Prepared_statement::execute_loop (this=0x7fe0cc949070, expanded_query=0x7fe0d83d1d80, open_cursor=false, packet=0x0, packet_end=0x0) at /src/10.2/sql/sql_prepare.cc:3908
#20 0x00005555951bdca9 in mysql_sql_stmt_execute (thd=0x7fe0cc82def0) at /src/10.2/sql/sql_prepare.cc:3036
#21 0x00005555951987a6 in mysql_execute_command (thd=0x7fe0cc82def0) at /src/10.2/sql/sql_parse.cc:3349
#22 0x00005555951a6106 in mysql_parse (thd=0x7fe0cc82def0, rawbuf=0x7fe0cc867448 "execute stmt", length=12, parser_state=0x7fe0d83d29e0, is_next_command=false) at /src/10.2/sql/sql_parse.cc:7703
#23 0x0000555595194647 in dispatch_command (command=COM_QUERY, thd=0x7fe0cc82def0, packet=0x7fe0cc861171 "execute stmt", packet_length=12, is_com_multi=false, is_next_command=false) at /src/10.2/sql/sql_parse.cc:1790
#24 0x00005555951930bc in do_command (thd=0x7fe0cc82def0) at /src/10.2/sql/sql_parse.cc:1353
#25 0x00005555952c9392 in do_handle_one_connection (connect=0x7fe0d5c84310) at /src/10.2/sql/sql_connect.cc:1358
#26 0x00005555952c9124 in handle_one_connection (arg=0x7fe0d5c84310) at /src/10.2/sql/sql_connect.cc:1264
#27 0x00005555959de420 in pfs_spawn_thread (arg=0x7fe0d11c6ff0) at /src/10.2/storage/perfschema/pfs.cc:1862
#28 0x00007fe0d804d0a4 in start_thread () from /lib64/libpthread.so.0
#29 0x00007fe0d61bb04d in clone () from /lib64/libc.so.6

Test case

create table t1 (i int);
prepare stmt from "delete from t1 where i in ( select i from ( with x as ( select i from t1 ) select * from x ) sq)";
execute stmt;
insert into t1 values (1),(2);
execute stmt;



 Comments   
Comment by Sergei Petrunia [ 2016-09-04 ]

Doesn't crash anymore on 10.2, tip cset 3dcca1b7247fff8f0658c38ebdecc5de4cfc8ca0.

Comment by Sergei Petrunia [ 2016-09-04 ]

I assume it's not worth it to figure out which particular cset has fixed this.
Closing. Feel free to re-open if you think otherwise.

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