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

SIGSEGV in heap_info on second stored procedure call

    XMLWordPrintable

Details

    Description

      Somewhat similar to MDEV-23213, but the versions affected are different and optimizer setting derived_merge is not modified/used here. Also noting that MDEV-23213 does not reproduce on MySQL 5.5 as derived_merge is not implemented there.

      CREATE TABLE t2 (c INT,c2 CHAR(1),c3 DATE) ENGINE=InnoDB;
      CREATE PROCEDURE p (cnt INT(1)) SELECT COUNT(*) INTO cnt FROM t;
      CREATE VIEW t AS SELECT * FROM t2;
      CREATE TEMPORARY TABLE t (c TEXT);
      CALL p (1);
      DROP TEMPORARY TABLE IF EXISTS t,t2;
      CALL p (1);
      

      Leads to:

      10.9.0 b5852ffbeebc3000982988383daeefb0549e058a (Debug)

      Core was generated by `/test/MD140222-mariadb-10.9.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  heap_info (info=0x0, x=x@entry=0x14a57c0ae2b0, flag=flag@entry=18)
          at /test/10.9_dbg/storage/heap/hp_info.c:34
      34	  x->records         = info->s->records;
      [Current thread is 1 (Thread 0x14a57c0b2700 (LWP 4012922))]
      (gdb) bt
      #0  heap_info (info=0x0, x=x@entry=0x14a57c0ae2b0, flag=flag@entry=18) at /test/10.9_dbg/storage/heap/hp_info.c:34
      #1  0x00005602557402dc in ha_heap::info (this=0x14a4ec0a9120, flag=18) at /test/10.9_dbg/storage/heap/ha_heap.cc:370
      #2  0x0000560254f94b27 in opt_sum_query (thd=0x14a4ec000db8, tables=@0x14a4ec0544b0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14a4ec05e7f8, last = 0x14a4ec05e7f8, elements = 1}, <No data fields>}, all_fields=@0x14a4ec05dd78: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14a4ec0548a8, last = 0x14a4ec0548a8, elements = 1}, <No data fields>}, conds=0x0) at /test/10.9_dbg/sql/opt_sum.cc:318
      #3  0x000056025513da9e in JOIN::optimize_inner (this=this@entry=0x14a4ec05da10) at /test/10.9_dbg/sql/sql_select.cc:2374
      #4  0x000056025513e1dc in JOIN::optimize (this=this@entry=0x14a4ec05da10) at /test/10.9_dbg/sql/sql_select.cc:1808
      #5  0x000056025513e880 in mysql_select (thd=thd@entry=0x14a4ec000db8, tables=0x14a4ec0549b8, fields=@0x14a4ec054538: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14a4ec0548a8, last = 0x14a4ec0548a8, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147749632, result=0x14a4ec0548d8, unit=0x14a4ec0553e8, select_lex=0x14a4ec054298) at /test/10.9_dbg/sql/sql_select.cc:4993
      #6  0x000056025513eb84 in handle_select (thd=thd@entry=0x14a4ec000db8, lex=lex@entry=0x14a4ec055310, result=result@entry=0x14a4ec0548d8, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.9_dbg/sql/sql_select.cc:543
      #7  0x000056025509e124 in execute_sqlcom_select (thd=thd@entry=0x14a4ec000db8, all_tables=0x14a4ec0549b8) at /test/10.9_dbg/sql/sql_parse.cc:6252
      #8  0x00005602550ab08b in mysql_execute_command (thd=0x14a4ec000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.9_dbg/sql/sql_parse.cc:3943
      #9  0x0000560254fc21cc in sp_instr_stmt::exec_core (this=0x14a4ec0550b8, thd=<optimized out>, nextp=0x14a57c0b022c) at /test/10.9_dbg/sql/sp_head.cc:3834
      #10 0x0000560254fd0c4b in sp_lex_keeper::reset_lex_and_exec_core (this=this@entry=0x14a4ec055100, thd=thd@entry=0x14a4ec000db8, nextp=nextp@entry=0x14a57c0b022c, open_tables=open_tables@entry=false, instr=instr@entry=0x14a4ec0550b8) at /test/10.9_dbg/sql/sp_head.cc:3560
      #11 0x0000560254fd1566 in sp_instr_stmt::execute (this=0x14a4ec0550b8, thd=0x14a4ec000db8, nextp=0x14a57c0b022c) at /test/10.9_dbg/sql/sp_head.cc:3740
      #12 0x0000560254fc8bcd in sp_head::execute (this=this@entry=0x14a4ec053280, thd=thd@entry=0x14a4ec000db8, merge_da_on_success=merge_da_on_success@entry=true) at /test/10.9_dbg/sql/sp_head.cc:1437
      #13 0x0000560254fcb24e in sp_head::execute_procedure (this=0x14a4ec053280, thd=thd@entry=0x14a4ec000db8, args=0x14a4ec006098) at /test/10.9_dbg/sql/sp_head.cc:2424
      #14 0x000056025509da19 in do_execute_sp (thd=thd@entry=0x14a4ec000db8, sp=sp@entry=0x14a4ec053280) at /test/10.9_dbg/sql/sql_parse.cc:3023
      #15 0x00005602550a348a in Sql_cmd_call::execute (this=0x14a4ec013e90, thd=0x14a4ec000db8) at /test/10.9_dbg/sql/sql_parse.cc:3269
      #16 0x00005602550b080e in mysql_execute_command (thd=thd@entry=0x14a4ec000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.9_dbg/sql/sql_parse.cc:5988
      #17 0x0000560255097315 in mysql_parse (thd=thd@entry=0x14a4ec000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14a57c0b1400) at /test/10.9_dbg/sql/sql_parse.cc:8027
      #18 0x00005602550a5fb1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14a4ec000db8, packet=packet@entry=0x14a4ec00b889 "CALL p (1)", packet_length=packet_length@entry=10, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_class.h:1362
      #19 0x00005602550a93f8 in do_command (thd=0x14a4ec000db8, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_parse.cc:1402
      #20 0x0000560255223fc4 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x56025862b848, put_in_cache=put_in_cache@entry=true) at /test/10.9_dbg/sql/sql_connect.cc:1418
      #21 0x00005602552245c9 in handle_one_connection (arg=arg@entry=0x56025862b848) at /test/10.9_dbg/sql/sql_connect.cc:1312
      #22 0x00005602556aad67 in pfs_spawn_thread (arg=0x56025853e9a8) at /test/10.9_dbg/storage/perfschema/pfs.cc:2201
      #23 0x000014a587a25609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #24 0x000014a587613293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.3.33 (dbg), 10.3.33 (opt), 10.4.23 (dbg), 10.4.23 (opt), 10.5.14 (dbg), 10.5.14 (opt), 10.6.6 (dbg), 10.6.6 (opt), 10.7.2 (dbg), 10.7.2 (opt), 10.8.1 (dbg), 10.8.1 (opt), 10.9.0 (dbg), 10.9.0 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.2.42 (dbg), 10.2.42 (opt)
      MySQL: 5.6.51 (dbg), 5.6.51 (opt), 5.7.36 (dbg), 5.7.36 (opt), 8.0.27 (dbg), 8.0.27 (opt)

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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