[MDEV-9503] Server crashes in fix_fields, main.null fails with ps-protocol Created: 2016-02-01  Updated: 2016-02-22  Resolved: 2016-02-01

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.1
Fix Version/s: 10.1.12

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: regression

Issue Links:
Relates
relates to MDEV-9606 Server crashes in fix_fields, main.nu... Closed

 Description   

http://buildbot.askmonty.org/buildbot/builders/kvm-fulltest/builds/5409/steps/test_7/logs/stdio

Stack trace from 10.1.11 release

#2  <signal handler called>
#3  0x00005564f261a1f6 in fix_fields (thd=0x7f49053de008, this=0x7f4900704850, ref=<optimized out>) at /home/buildbot/buildbot/build/sql/item_func.cc:214
#4  Item_func::fix_fields (this=0x7f4900704850, thd=0x7f49053de008, ref=<optimized out>) at /home/buildbot/buildbot/build/sql/item_func.cc:175
#5  0x00005564f241c133 in setup_fields (thd=0x7f49053de008, ref_pointer_array=0x7f4900705098, fields=..., mark_used_columns=mark_used_columns@entry=MARK_COLUMNS_READ, sum_func_list=sum_func_list@entry=0x7f49004c7440, allow_sum_func=allow_sum_func@entry=true) at /home/buildbot/buildbot/build/sql/sql_base.cc:7950
#6  0x00005564f249d782 in prepare (unit_arg=0x7f49007030e8, select_lex_arg=0x7f49007037e8, proc_param_init=0x0, having_init=0x0, group_init=0x0, skip_order_by=false, order_init=0x0, og_num=0, conds_init=<optimized out>, wild_num=0, tables_init=<optimized out>, rref_pointer_array=0x7f4900703a60, this=<optimized out>) at /home/buildbot/buildbot/build/sql/sql_select.cc:795
#7  JOIN::prepare (this=<optimized out>, rref_pointer_array=0x7f4900703a60, tables_init=<optimized out>, wild_num=0, conds_init=<optimized out>, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7f49007037e8, unit_arg=0x7f49007030e8) at /home/buildbot/buildbot/build/sql/sql_select.cc:686
#8  0x00005564f24aa0c4 in mysql_select (thd=thd@entry=0x7f49053de008, rref_pointer_array=rref_pointer_array@entry=0x7f4900703a60, tables=0x7f4900704a70, wild_num=<optimized out>, fields=..., conds=<optimized out>, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184064, result=result@entry=0x7f4900705078, unit=unit@entry=0x7f49007030e8, select_lex=select_lex@entry=0x7f49007037e8) at /home/buildbot/buildbot/build/sql/sql_select.cc:3429
#9  0x00005564f24ad19d in handle_select (thd=thd@entry=0x7f49053de008, lex=lex@entry=0x7f4900703020, result=result@entry=0x7f4900705078, setup_tables_done_option=setup_tables_done_option@entry=0) at /home/buildbot/buildbot/build/sql/sql_select.cc:384
#10 0x00005564f244fa72 in execute_sqlcom_select (thd=thd@entry=0x7f49053de008, all_tables=0x7f4900704a70) at /home/buildbot/buildbot/build/sql/sql_parse.cc:5903
#11 0x00005564f245bce0 in mysql_execute_command (thd=0x7f49053de008) at /home/buildbot/buildbot/build/sql/sql_parse.cc:2962
#12 0x00005564f247197a in Prepared_statement::execute (this=this@entry=0x7f4900500288, expanded_query=expanded_query@entry=0x7f490b21a410, open_cursor=open_cursor@entry=false) at /home/buildbot/buildbot/build/sql/sql_prepare.cc:4265
#13 0x00005564f2471a6c in Prepared_statement::execute_loop (this=0x7f4900500288, expanded_query=0x7f490b21a410, open_cursor=false, packet_end=<optimized out>, packet=<optimized out>) at /home/buildbot/buildbot/build/sql/sql_prepare.cc:3897
#14 0x00005564f24727ce in mysqld_stmt_execute (thd=thd@entry=0x7f49053de008, packet_arg=packet_arg@entry=0x7f49047f7009 "\217", packet_length=packet_length@entry=9) at /home/buildbot/buildbot/build/sql/sql_prepare.cc:2974
#15 0x00005564f2460bd8 in dispatch_command (command=command@entry=COM_STMT_EXECUTE, thd=thd@entry=0x7f49053de008, packet=0x7f49047f7009 "\217", packet_length=packet_length@entry=9) at /home/buildbot/buildbot/build/sql/sql_parse.cc:1432
#16 0x00005564f24620ab in do_command (thd=0x7f49053de008) at /home/buildbot/buildbot/build/sql/sql_parse.cc:1109
#17 0x00005564f251d77f in do_handle_one_connection (thd_arg=thd_arg@entry=0x7f49053de008) at /home/buildbot/buildbot/build/sql/sql_connect.cc:1349
#18 0x00005564f251d8d7 in handle_one_connection (arg=arg@entry=0x7f49053de008) at /home/buildbot/buildbot/build/sql/sql_connect.cc:1261
#19 0x00005564f295331d in pfs_spawn_thread (arg=0x7f4908c40a08) at /home/buildbot/buildbot/build/storage/perfschema/pfs.cc:1860
#20 0x00007f490a3fa0a4 in start_thread () from /lib64/libpthread.so.0

Stack trace from 10.1 debug commit 7b14ba63f22e6c98c1982dae8847035ad1b8e155

mysqld: /src/10.1/sql/item_cmpfunc.cc:2572: virtual void Item_func_nullif::fix_length_and_dec(): Assertion `args[0] == args[2]' failed.
160201  0:47:27 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f7cf507b1d2 in __assert_fail () from /lib64/libc.so.6
#8  0x0000560c5602d325 in Item_func_nullif::fix_length_and_dec (this=0x7f7ceb9e7ae0) at /src/10.1/sql/item_cmpfunc.cc:2572
#9  0x0000560c560552ba in Item_func::fix_fields (this=0x7f7ceb9e7ae0, thd=0x7f7cf0fc9b30, ref=0x7f7ceb9e7d00) at /src/10.1/sql/item_func.cc:234
#10 0x0000560c5605508a in Item_func::fix_fields (this=0x7f7ceb9e7c78, thd=0x7f7cf0fc9b30, ref=0x7f7ceb9e7d38) at /src/10.1/sql/item_func.cc:208
#11 0x0000560c55d5ae31 in setup_fields (thd=0x7f7cf0fc9b30, ref_pointer_array=0x7f7ceb9e8428, fields=..., mark_used_columns=MARK_COLUMNS_READ, sum_func_list=0x7f7ceb852f68, allow_sum_func=true) at /src/10.1/sql/sql_base.cc:7950
#12 0x0000560c55df1ad8 in JOIN::prepare (this=0x7f7ceb852c08, rref_pointer_array=0x7f7ceb9e6b48, tables_init=0x7f7ceb9e7e00, wild_num=0, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7f7ceb9e68d0, unit_arg=0x7f7ceb9e61d0) at /src/10.1/sql/sql_select.cc:795
#13 0x0000560c55dfb232 in mysql_select (thd=0x7f7cf0fc9b30, rref_pointer_array=0x7f7ceb9e6b48, tables=0x7f7ceb9e7e00, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184064, result=0x7f7ceb9e8408, unit=0x7f7ceb9e61d0, select_lex=0x7f7ceb9e68d0) at /src/10.1/sql/sql_select.cc:3429
#14 0x0000560c55df0d89 in handle_select (thd=0x7f7cf0fc9b30, lex=0x7f7ceb9e6108, result=0x7f7ceb9e8408, setup_tables_done_option=0) at /src/10.1/sql/sql_select.cc:384
#15 0x0000560c55dc1133 in execute_sqlcom_select (thd=0x7f7cf0fc9b30, all_tables=0x7f7ceb9e7e00) at /src/10.1/sql/sql_parse.cc:5903
#16 0x0000560c55db720d in mysql_execute_command (thd=0x7f7cf0fc9b30) at /src/10.1/sql/sql_parse.cc:2962
#17 0x0000560c55ddeb97 in Prepared_statement::execute (this=0x7f7ceb89c070, expanded_query=0x7f7cf7345400, open_cursor=false) at /src/10.1/sql/sql_prepare.cc:4265
#18 0x0000560c55ddda32 in Prepared_statement::execute_loop (this=0x7f7ceb89c070, expanded_query=0x7f7cf7345400, open_cursor=false, packet=0x7f7cf01c943a "", packet_end=0x7f7cf01c943a "") at /src/10.1/sql/sql_prepare.cc:3897
#19 0x0000560c55ddb89b in mysqld_stmt_execute (thd=0x7f7cf0fc9b30, packet_arg=0x7f7cf01c9431 "\200", packet_length=9) at /src/10.1/sql/sql_prepare.cc:2974
#20 0x0000560c55db3126 in dispatch_command (command=COM_STMT_EXECUTE, thd=0x7f7cf0fc9b30, packet=0x7f7cf01c9431 "\200", packet_length=9) at /src/10.1/sql/sql_parse.cc:1432
#21 0x0000560c55db21a6 in do_command (thd=0x7f7cf0fc9b30) at /src/10.1/sql/sql_parse.cc:1109
#22 0x0000560c55ee7798 in do_handle_one_connection (thd_arg=0x7f7cf0fc9b30) at /src/10.1/sql/sql_connect.cc:1349
#23 0x0000560c55ee74fc in handle_one_connection (arg=0x7f7cf0fc9b30) at /src/10.1/sql/sql_connect.cc:1261
#24 0x0000560c565edbf2 in pfs_spawn_thread (arg=0x7f7cefbb0e70) at /src/10.1/storage/perfschema/pfs.cc:1860
#25 0x00007f7cf6fc40a4 in start_thread () from /lib64/libpthread.so.0

The problem was introduced by the following revision:

commit ce40ccaf24af2fe395f541cb1079256de8727ccd
Author: Alexander Barkov <bar@mariadb.org>
Date:   Thu Jan 28 13:58:39 2016 +0400
 
    MDEV-9181 (NULLIF(count(table.col)), 0) gives wrong result on 10.1.x
    Wrapping args[0] and args[2] into an Item_cache for aggregate functions.


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