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

Server crash in in Item_func_in::val_int or assertion `in_item' failure upon SELECT with impossible condition

    XMLWordPrintable

Details

    Description

      CREATE TABLE t1 (i INT);
      INSERT INTO t1 VALUES (1),(2);
      SELECT * FROM ( SELECT DISTINCT * FROM t1 ) a WHERE ( i > 0 AND i < 5 OR i IN (6,8) ) AND ( i = 85 OR 0 );
       
      # Cleanup
      DROP TABLE t1;
      

      10.3 non-debug 469a4b02ceb39ff

      #2  <signal handler called>
      #3  0x00005598c1828df7 in Item_func_in::val_int (this=0x7f1274013f18) at /data/src/10.2/sql/item_cmpfunc.cc:4385
      #4  0x00005598c18237fc in Item_cond::fix_fields (this=0x7f12740137f0, thd=0x7f12740009a8, ref=<optimized out>) at /data/src/10.2/sql/item_cmpfunc.cc:4546
      #5  0x00005598c1710ce0 in TABLE_LIST::build_pushable_cond_for_table (this=this@entry=0x7f12740105e0, thd=thd@entry=0x7f12740009a8, cond=<optimized out>) at /data/src/10.2/sql/table.cc:8232
      #6  0x00005598c1710b9b in TABLE_LIST::build_pushable_cond_for_table (this=this@entry=0x7f12740105e0, thd=thd@entry=0x7f12740009a8, cond=cond@entry=0x7f1274011c90) at /data/src/10.2/sql/table.cc:8219
      #7  0x00005598c163d7e9 in pushdown_cond_for_derived (thd=0x7f12740009a8, cond=0x7f1274011c90, derived=0x7f12740105e0) at /data/src/10.2/sql/sql_derived.cc:1270
      #8  0x00005598c16b0935 in JOIN::optimize_inner (this=0x7f1274011ea8) at /data/src/10.2/sql/sql_select.cc:1362
      #9  0x00005598c16b327a in JOIN::optimize (this=0x7f1274011ea8) at /data/src/10.2/sql/sql_select.cc:1113
      #10 0x00005598c16b574d in mysql_select (thd=thd@entry=0x7f12740009a8, tables=0x7f12740105e0, wild_num=1, fields=..., conds=0x7f1274011c90, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f1274011e88, unit=0x7f1274004390, select_lex=0x7f1274004ac8) at /data/src/10.2/sql/sql_select.cc:3747
      #11 0x00005598c16b5956 in handle_select (thd=thd@entry=0x7f12740009a8, lex=lex@entry=0x7f12740042c8, result=result@entry=0x7f1274011e88, setup_tables_done_option=setup_tables_done_option@entry=0) at /data/src/10.2/sql/sql_select.cc:376
      #12 0x00005598c15a430f in execute_sqlcom_select (thd=0x7f12740009a8, all_tables=0x7f12740105e0) at /data/src/10.2/sql/sql_parse.cc:6472
      #13 0x00005598c165f532 in mysql_execute_command (thd=0x7f12740009a8) at /data/src/10.2/sql/sql_parse.cc:3483
      #14 0x00005598c166605a in mysql_parse (thd=0x7f12740009a8, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.2/sql/sql_parse.cc:7924
      #15 0x00005598c1669a0c in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f12740009a8, packet=packet@entry=0x7f1274006d19 "SELECT * FROM ( SELECT DISTINCT * FROM t1 ) a WHERE ( i > 0 AND i < 5 OR i IN (6,8) ) AND ( i = 85 OR 0 )", packet_length=packet_length@entry=105, 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:1820
      #16 0x00005598c166a3f9 in do_command (thd=0x7f12740009a8) at /data/src/10.2/sql/sql_parse.cc:1374
      #17 0x00005598c1731a24 in do_handle_one_connection (connect=connect@entry=0x5598c4de3068) at /data/src/10.2/sql/sql_connect.cc:1335
      #18 0x00005598c1731bc4 in handle_one_connection (arg=arg@entry=0x5598c4de3068) at /data/src/10.2/sql/sql_connect.cc:1241
      #19 0x00005598c19f2af4 in pfs_spawn_thread (arg=0x5598c4d985d8) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #20 0x00007f1296d35494 in start_thread (arg=0x7f12902e3700) at pthread_create.c:333
      #21 0x00007f129511b93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      10.2 da3c5c3c9ad53 debug

      mysqld: /data/src/10.2/sql/item_cmpfunc.cc:4382: virtual longlong Item_func_in::val_int(): Assertion `in_item' failed.
      180504  2:40:35 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f4df41b6ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x00005655533da44f in Item_func_in::val_int (this=0x7f4ddc017350) at /data/src/10.2/sql/item_cmpfunc.cc:4382
      #19 0x000056555312b846 in mysql_parse (thd=0x7f4ddc000b00, rawbuf=0x7f4ddc0124f8 "SELECT * FROM ( SELECT DISTINCT * FROM t1 ) a WHERE ( i > 0 AND i < 5 OR i IN (6,8) ) AND ( i = 85 OR 0 )", length=105, parser_state=0x7f4dee492200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7924
      #20 0x00005655531196db in dispatch_command (command=COM_QUERY, thd=0x7f4ddc000b00, packet=0x7f4ddc147241 "SELECT * FROM ( SELECT DISTINCT * FROM t1 ) a WHERE ( i > 0 AND i < 5 OR i IN (6,8) ) AND ( i = 85 OR 0 )", packet_length=105, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1820
      #21 0x000056555311803e in do_command (thd=0x7f4ddc000b00) at /data/src/10.2/sql/sql_parse.cc:1374
      #22 0x0000565553266da4 in do_handle_one_connection (connect=0x565556d45130) at /data/src/10.2/sql/sql_connect.cc:1335
      #23 0x0000565553266b31 in handle_one_connection (arg=0x565556d45130) at /data/src/10.2/sql/sql_connect.cc:1241
      #24 0x00005655536876a8 in pfs_spawn_thread (arg=0x565556ca4010) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #25 0x00007f4df5e8d494 in start_thread (arg=0x7f4dee493700) at pthread_create.c:333
      #26 0x00007f4df427393f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      The problem appeared in 10.2 tree with this revision:

      commit 6223f1dd98c81b6c53bf15595ae6fb32f3a3c54c
      Author: Galina Shalygina
      Date:   Sun Mar 25 22:12:38 2018 +0200
       
          MDEV-15579 Crash in Item_field::used_tables() called by
                     Item::derived_field_transformer_for_having
      

      Attachments

        Activity

          People

            shagalla Galina Shalygina (Inactive)
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.