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

SIGSEGV in Item::cleanup from Item::cleanup_processor

    XMLWordPrintable

Details

    Description

      CREATE TABLE t (a INT,b DATE,PRIMARY KEY(a,b)) ENGINE=InnoDB PARTITION BY RANGE (TO_DAYS (b)) SUBPARTITION BY HASH (a) SUBPARTITIONS 2 (PARTITION p0 VALUES LESS THAN (TO_DAYS ('2009-01-01')),PARTITION p VALUES LESS THAN (TO_DAYS ('2009-02-01')),PARTITION p2 VALUES LESS THAN (TO_DAYS ('2009-03-01')),PARTITION p3 VALUES LESS THAN MAXVALUE);
      SELECT b,COUNT(DISTINCT a) FROM t GROUP BY b HAVING b is NULL;
      

      Leads to:

      10.7.0 52505bf20de0ce77a5c0b0a74af021051987bb0d (Debug)

      Core was generated by `/test/MD160821-mariadb-10.7.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  Item::cleanup (this=0x14a2c6271018) at /test/10.7_dbg/sql/item.cc:552
      [Current thread is 1 (Thread 0x14a2b0d70700 (LWP 3269020))]
      (gdb) bt
      #0  Item::cleanup (this=0x14a2c6271018) at /test/10.7_dbg/sql/item.cc:552
      #1  0x00005578c26f3e3c in Item::cleanup_processor (this=<optimized out>, arg=<optimized out>) at /test/10.7_dbg/sql/item.cc:572
      #2  0x00005578c27155b3 in Item::cleanup_excluding_immutables_processor (this=<optimized out>, arg=<optimized out>) at /test/10.7_dbg/sql/item.cc:10738
      #3  0x00005578c229acbf in Item::walk (this=<optimized out>, processor=<optimized out>, walk_subquery=<optimized out>, arg=<optimized out>) at /test/10.7_dbg/sql/item.h:2104
      #4  0x00005578c22c6633 in Item_args::walk_args (arg=0x1, walk_subquery=false, processor=<optimized out>, this=0x14a278016360) at /test/10.7_dbg/sql/item.h:2742
      #5  Item_func_or_sum::walk (this=0x14a2780162f0, processor=<optimized out>, walk_subquery=false, arg=0x1) at /test/10.7_dbg/sql/item.h:5437
      #6  0x00005578c23bcf57 in st_select_lex::pushdown_from_having_into_where (this=0x14a278013d58, thd=0x14a278000db8, having=0x0) at /test/10.7_dbg/sql/sql_lex.cc:11129
      #7  0x00005578c246f4a8 in JOIN::optimize_inner (this=this@entry=0x14a278015960) at /test/10.7_dbg/sql/sql_select.cc:2223
      #8  0x00005578c247002e in JOIN::optimize (this=this@entry=0x14a278015960) at /test/10.7_dbg/sql/sql_select.cc:1809
      #9  0x00005578c24706a7 in mysql_select (thd=thd@entry=0x14a278000db8, tables=0x14a2780145d0, fields=@0x14a278013ff8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14a2780142f0, last = 0x14a278014570, elements = 2}, <No data fields>}, conds=0x0, og_num=1, order=0x0, group=0x14a278014de8, having=0x14a278014f48, proc_param=0x0, select_options=2147748608, result=0x14a278015938, unit=0x14a278005120, select_lex=0x14a278013d58) at /test/10.7_dbg/sql/sql_select.cc:4977
      #10 0x00005578c24709ab in handle_select (thd=thd@entry=0x14a278000db8, lex=lex@entry=0x14a278005058, result=result@entry=0x14a278015938, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.7_dbg/sql/sql_select.cc:545
      #11 0x00005578c23d272e in execute_sqlcom_select (thd=thd@entry=0x14a278000db8, all_tables=0x14a2780145d0) at /test/10.7_dbg/sql/sql_parse.cc:6256
      #12 0x00005578c23df5d1 in mysql_execute_command (thd=thd@entry=0x14a278000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.7_dbg/sql/sql_parse.cc:3946
      #13 0x00005578c23cbac3 in mysql_parse (thd=thd@entry=0x14a278000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14a2b0d6f400) at /test/10.7_dbg/sql/sql_parse.cc:8030
      #14 0x00005578c23da6c8 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14a278000db8, packet=packet@entry=0x14a27800b739 "SELECT b,COUNT(DISTINCT a) FROM t GROUP BY b HAVING b is NULL", packet_length=packet_length@entry=61, blocking=blocking@entry=true) at /test/10.7_dbg/sql/sql_class.h:1357
      #15 0x00005578c23ddae9 in do_command (thd=0x14a278000db8, blocking=blocking@entry=true) at /test/10.7_dbg/sql/sql_parse.cc:1404
      #16 0x00005578c2553dd6 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5578c5d0e388, put_in_cache=put_in_cache@entry=true) at /test/10.7_dbg/sql/sql_connect.cc:1418
      #17 0x00005578c25543db in handle_one_connection (arg=arg@entry=0x5578c5d0e388) at /test/10.7_dbg/sql/sql_connect.cc:1312
      #18 0x00005578c29bcce4 in pfs_spawn_thread (arg=0x5578c5c36fd8) at /test/10.7_dbg/storage/perfschema/pfs.cc:2201
      #19 0x000014a2c6126609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #20 0x000014a2c5d14293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      10.7.0 52505bf20de0ce77a5c0b0a74af021051987bb0d (Optimized)

      Core was generated by `/test/MD160821-mariadb-10.7.0-linux-x86_64-opt/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x00005607f75fb652 in Item::cleanup (this=0x153e4bf85018)
          at /test/10.7_opt/sql/item.cc:552
      [Current thread is 1 (Thread 0x153e40500700 (LWP 3267608))]
      (gdb) bt
      #0  0x00005607f75fb652 in Item::cleanup (this=0x153e4bf85018) at /test/10.7_opt/sql/item.cc:552
      #1  0x00005607f76143d9 in Item::cleanup_processor (arg=<optimized out>, this=<optimized out>) at /test/10.7_opt/sql/item.cc:572
      #2  Item::cleanup_processor (arg=<optimized out>, this=<optimized out>) at /test/10.7_opt/sql/item.cc:569
      #3  Item::cleanup_excluding_immutables_processor (this=<optimized out>, arg=<optimized out>) at /test/10.7_opt/sql/item.cc:10738
      #4  0x00005607f72d32ec in Item_args::walk_args (arg=0x1, walk_subquery=false, processor=<optimized out>, this=0x153ddc012e80) at /test/10.7_opt/sql/item.h:2742
      #5  Item_func_or_sum::walk (this=0x153ddc012e10, processor=(bool (Item::*)(Item * const, void *)) 0x5607f76143a0 <Item::cleanup_excluding_immutables_processor(void*)>, walk_subquery=false, arg=0x1) at /test/10.7_opt/sql/item.h:5437
      #6  0x00005607f739172f in st_select_lex::pushdown_from_having_into_where (this=0x153ddc010878, thd=0x153ddc000c58, having=0x0) at /test/10.7_opt/sql/sql_lex.cc:11129
      #7  0x00005607f741b816 in JOIN::optimize_inner (this=0x153ddc012480) at /test/10.7_opt/sql/sql_select.cc:2223
      #8  0x00005607f741e643 in JOIN::optimize (this=this@entry=0x153ddc012480) at /test/10.7_opt/sql/sql_select.cc:1809
      #9  0x00005607f741e707 in mysql_select (thd=0x153ddc000c58, tables=0x153ddc0110f0, fields=<optimized out>, conds=0x0, og_num=1, order=0x0, group=0x153ddc011908, having=0x153ddc011a68, proc_param=0x0, select_options=<optimized out>, result=0x153ddc012458, unit=0x153ddc004e00, select_lex=0x153ddc010878) at /test/10.7_opt/sql/sql_select.cc:4977
      #10 0x00005607f741ef27 in handle_select (thd=thd@entry=0x153ddc000c58, lex=lex@entry=0x153ddc004d38, result=result@entry=0x153ddc012458, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.7_opt/sql/sql_select.cc:545
      #11 0x00005607f73a2321 in execute_sqlcom_select (thd=0x153ddc000c58, all_tables=0x153ddc0110f0) at /test/10.7_opt/sql/sql_parse.cc:6256
      #12 0x00005607f73b01a8 in mysql_execute_command (thd=0x153ddc000c58, is_called_from_prepared_stmt=<optimized out>) at /test/10.7_opt/sql/sql_parse.cc:3946
      #13 0x00005607f739d336 in mysql_parse (thd=0x153ddc000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /test/10.7_opt/sql/sql_parse.cc:8030
      #14 0x00005607f73a9225 in dispatch_command (command=COM_QUERY, thd=0x153ddc000c58, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /test/10.7_opt/sql/sql_class.h:1357
      #15 0x00005607f73ab147 in do_command (thd=0x153ddc000c58, blocking=blocking@entry=true) at /test/10.7_opt/sql/sql_parse.cc:1404
      #16 0x00005607f74c6967 in do_handle_one_connection (connect=<optimized out>, put_in_cache=true) at /test/10.7_opt/sql/sql_connect.cc:1418
      #17 0x00005607f74c6cad in handle_one_connection (arg=arg@entry=0x5607fa53bec8) at /test/10.7_opt/sql/sql_connect.cc:1312
      #18 0x00005607f7819648 in pfs_spawn_thread (arg=0x5607fa167c88) at /test/10.7_opt/storage/perfschema/pfs.cc:2201
      #19 0x0000153e4be3a609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #20 0x0000153e4ba28293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.7.0 (dbg), 10.7.0 (opt)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.2.41 (dbg), 10.2.41 (opt), 10.3.32 (dbg), 10.3.32 (opt), 10.4.22 (dbg), 10.4.22 (opt), 10.5.13 (dbg), 10.5.13 (opt), 10.6.5 (dbg), 10.6.5 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.35 (dbg), 5.7.35 (opt), 8.0.26 (dbg), 8.0.26 (opt)

      Regression: 10.6.5 gives empty set:

      10.6.5 9ac1ac006197c8979db1dc73f4e983f623e831e8 (Debug)

      10.6.5-dbg>SELECT b,COUNT(DISTINCT a) FROM t GROUP BY b HAVING b is NULL;
      Empty set (0.017 sec)
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.