Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-26000

Server crash or Assertion `cmp_items[(uint)cmp_type]' failed in Item_func_case::find_item

    XMLWordPrintable

    Details

      Description

      This is a non-debug crash upon a fairly basic use case, but given that only 10.2 appears to be affected, chances are the release line will go EOL before it gets fixed. Still, it needs to be filed at least

      CREATE TABLE t (a INT);
      INSERT INTO t VALUES (1),(2);
      CREATE ALGORITHM=TEMPTABLE VIEW v AS SELECT * FROM t;
      SELECT * FROM v WHERE a IN (CASE 3 WHEN 4 THEN 5 END, 6);
       
      # Cleanup
      DROP VIEW v;
      DROP TABLE t;
      

      10.2 aaaed9ba

      #3  <signal handler called>
      #4  0x0000559ec7d8ef4d in Item_func_case::find_item (this=this@entry=0x7f7d84013b80, str=str@entry=0x7f7d95aae200) at /data/src/10.2/sql/item_cmpfunc.cc:3080
      #5  0x0000559ec7d8f101 in Item_func_case::int_op (this=0x7f7d84013b80) at /data/src/10.2/sql/item_cmpfunc.cc:3117
      #6  0x0000559ec7db82dd in Item_func_hybrid_field_type::val_int (this=0x7f7d84013b80) at /data/src/10.2/sql/item_func.cc:944
      #7  0x0000559ec7d84bb7 in in_longlong::set (this=<optimized out>, pos=<optimized out>, item=0x7f7d84013b80) at /data/src/10.2/sql/item_cmpfunc.cc:3756
      #8  0x0000559ec7d903a0 in Item_func_in::create_array (this=this@entry=0x7f7d84013d68, thd=thd@entry=0x7f7d84000c48) at /data/src/10.2/sql/item_cmpfunc.cc:4217
      #9  0x0000559ec7d9085b in Item_func_in::fix_length_and_dec (this=<optimized out>) at /data/src/10.2/sql/item_cmpfunc.cc:4375
      #10 0x0000559ec7d910b0 in Item_func_in::build_clone (this=<optimized out>, thd=<optimized out>, mem_root=<optimized out>) at /data/src/10.2/sql/item_cmpfunc.cc:4492
      #11 0x0000559ec7c63ab9 in TABLE_LIST::build_pushable_cond_for_table (this=this@entry=0x7f7d8400f588, thd=thd@entry=0x7f7d84000c48, cond=cond@entry=0x7f7d84010128) at /data/src/10.2/sql/table.cc:8624
      #12 0x0000559ec7b7d892 in pushdown_cond_for_derived (thd=0x7f7d84000c48, cond=0x7f7d84010128, derived=derived@entry=0x7f7d8400f588) at /data/src/10.2/sql/sql_derived.cc:1265
      #13 0x0000559ec7bff276 in JOIN::optimize_inner (this=0x7f7d84012820) at /data/src/10.2/sql/sql_select.cc:1410
      #14 0x0000559ec7c02359 in JOIN::optimize (this=0x7f7d84012820) at /data/src/10.2/sql/sql_select.cc:1127
      #15 JOIN::optimize (this=0x7f7d84012820) at /data/src/10.2/sql/sql_select.cc:1119
      #16 0x0000559ec7c044a1 in mysql_select (thd=0x7f7d84000c48, tables=0x7f7d8400f588, wild_num=1, fields=..., conds=0x7f7d84010128, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=<optimized out>, result=0x7f7d84012800, unit=0x7f7d84004680, select_lex=0x7f7d84004dd0) at /data/src/10.2/sql/sql_select.cc:3835
      #17 0x0000559ec7c04777 in handle_select (thd=thd@entry=0x7f7d84000c48, lex=lex@entry=0x7f7d840045c0, result=result@entry=0x7f7d84012800, setup_tables_done_option=setup_tables_done_option@entry=0) at /data/src/10.2/sql/sql_select.cc:361
      #18 0x0000559ec7b99d21 in execute_sqlcom_select (thd=0x7f7d84000c48, all_tables=0x7f7d8400f588) at /data/src/10.2/sql/sql_parse.cc:6271
      #19 0x0000559ec7ba752a in mysql_execute_command (thd=<optimized out>) at /data/src/10.2/sql/sql_parse.cc:3582
      #20 0x0000559ec7baa22b in mysql_parse (thd=thd@entry=0x7f7d84000c48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7f7d95ab0520, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.2/sql/sql_parse.cc:7793
      #21 0x0000559ec7bad43d in dispatch_command (command=COM_QUERY, thd=0x7f7d84000c48, packet=<optimized out>, packet_length=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.2/sql/sql_class.h:1109
      #22 0x0000559ec7bae65d in do_command (thd=0x7f7d84000c48) at /data/src/10.2/sql/sql_parse.cc:1381
      #23 0x0000559ec7c87a26 in do_handle_one_connection (connect=connect@entry=0x559ec9f9e2c8) at /data/src/10.2/sql/sql_connect.cc:1336
      #24 0x0000559ec7c87b9f in handle_one_connection (arg=arg@entry=0x559ec9f9e2c8) at /data/src/10.2/sql/sql_connect.cc:1241
      #25 0x0000559ec8224956 in pfs_spawn_thread (arg=0x559ec9faf1b8) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #26 0x00007f7d9bfb6609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #27 0x00007f7d9bbac293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      10.2 aaaed9ba

      mysqld: /data/src/10.2/sql/item_cmpfunc.cc:3077: Item* Item_func_case::find_item(String*): Assertion `cmp_items[(uint)cmp_type]' failed.
      210623 15:40:46 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f47a8b3bf36 in __GI___assert_fail (assertion=0x5628d684e620 "cmp_items[(uint)cmp_type]", file=0x5628d684d7a8 "/data/src/10.2/sql/item_cmpfunc.cc", line=3077, function=0x5628d684e5e0 "Item* Item_func_case::find_item(String*)") at assert.c:101
      #8  0x00005628d5fc2193 in Item_func_case::find_item (this=0x7f4790016f28, str=0x7f47a2b46af0) at /data/src/10.2/sql/item_cmpfunc.cc:3077
      #9  0x00005628d5fc249d in Item_func_case::int_op (this=0x7f4790016f28) at /data/src/10.2/sql/item_cmpfunc.cc:3117
      #10 0x00005628d5ff6e24 in Item_func_hybrid_field_type::val_int (this=0x7f4790016f28) at /data/src/10.2/sql/item_func.cc:944
      #11 0x00005628d5fc4422 in in_longlong::set (this=0x7f4790017230, pos=0, item=0x7f4790016f28) at /data/src/10.2/sql/item_cmpfunc.cc:3756
      #12 0x00005628d5fc5cbc in Item_func_in::create_array (this=0x7f4790017110, thd=0x7f4790000d90) at /data/src/10.2/sql/item_cmpfunc.cc:4217
      #13 0x00005628d5fc643a in Item_func_in::fix_length_and_dec (this=0x7f4790017110) at /data/src/10.2/sql/item_cmpfunc.cc:4375
      #14 0x00005628d5fc6a69 in Item_func_in::build_clone (this=0x7f47900134d0, thd=0x7f4790000d90, mem_root=0x7f4790005f18) at /data/src/10.2/sql/item_cmpfunc.cc:4492
      #15 0x00005628d5e0fe40 in TABLE_LIST::build_pushable_cond_for_table (this=0x7f4790012930, thd=0x7f4790000d90, cond=0x7f47900134d0) at /data/src/10.2/sql/table.cc:8624
      #16 0x00005628d5cc68a6 in pushdown_cond_for_derived (thd=0x7f4790000d90, cond=0x7f47900134d0, derived=0x7f4790012930) at /data/src/10.2/sql/sql_derived.cc:1265
      #17 0x00005628d5d37d50 in JOIN::optimize_inner (this=0x7f4790015bc8) at /data/src/10.2/sql/sql_select.cc:1410
      #18 0x00005628d5d36cc8 in JOIN::optimize (this=0x7f4790015bc8) at /data/src/10.2/sql/sql_select.cc:1127
      #19 0x00005628d5d4021e in mysql_select (thd=0x7f4790000d90, tables=0x7f4790012930, wild_num=1, fields=..., conds=0x7f47900134d0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f4790015ba8, unit=0x7f4790004988, select_lex=0x7f47900050d8) at /data/src/10.2/sql/sql_select.cc:3835
      #20 0x00005628d5d34402 in handle_select (thd=0x7f4790000d90, lex=0x7f47900048c8, result=0x7f4790015ba8, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:361
      #21 0x00005628d5cfeaf6 in execute_sqlcom_select (thd=0x7f4790000d90, all_tables=0x7f4790012930) at /data/src/10.2/sql/sql_parse.cc:6271
      #22 0x00005628d5cf566a in mysql_execute_command (thd=0x7f4790000d90) at /data/src/10.2/sql/sql_parse.cc:3582
      #23 0x00005628d5d028b2 in mysql_parse (thd=0x7f4790000d90, rawbuf=0x7f4790012708 "SELECT * FROM v WHERE a IN (CASE 3 WHEN 4 THEN 5 END, 6)", length=56, parser_state=0x7f47a2b48560, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7793
      #24 0x00005628d5cf0b0d in dispatch_command (command=COM_QUERY, thd=0x7f4790000d90, packet=0x7f4790008b61 "SELECT * FROM v WHERE a IN (CASE 3 WHEN 4 THEN 5 END, 6)", packet_length=56, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1827
      #25 0x00005628d5cef608 in do_command (thd=0x7f4790000d90) at /data/src/10.2/sql/sql_parse.cc:1381
      #26 0x00005628d5e4aa8b in do_handle_one_connection (connect=0x5628d92a30d0) at /data/src/10.2/sql/sql_connect.cc:1336
      #27 0x00005628d5e4a7f0 in handle_one_connection (arg=0x5628d92a30d0) at /data/src/10.2/sql/sql_connect.cc:1241
      #28 0x00005628d6676c50 in pfs_spawn_thread (arg=0x5628d92864d0) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #29 0x00007f47a904c609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #30 0x00007f47a8c27293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Reproducible on debug and non-debug 10.2 builds as described. EXPLAIN also crashes.
      Reproducible with at least MyISAM and InnoDB for the underlying table.
      Not reproducible with MERGE views.
      Not reproducible with the provided test case on 10.3+.

        Attachments

          Activity

            People

            Assignee:
            psergei Sergei Petrunia
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Git Integration