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

SIGSEGV in list_add on INSERT

    XMLWordPrintable

Details

    Description

      The following bug is present in bb-11.8-MDEV-35504-opt-hints but not in preview-11.8-preview (UBASAN, Clang compiled) nor in 11.8 trunk as of 1 January.

      --source include/have_innodb.inc
      SET sql_mode='';
      SET pseudo_slave_mode=1;
      CREATE TABLE t1 (c INT) ENGINE=InnoDB;
      CREATE TEMPORARY TABLE t2 (c INT) ENGINE=InnoDB;
      XA START 'x';
      INSERT INTO t1 VALUES (0);
      INSERT INTO t2 VALUES (0);
      XA END 'x';
      XA PREPARE 'x';
      DROP TABLE t2;
      CREATE TABLE t2 (c INT) ENGINE=MEMORY;
      SELECT * FROM t2;
      XA COMMIT 'x';
      INSERT INTO t2 SELECT * FROM t2;
      

      Leads to:

      bb-11.8-MDEV-35504-opt-hints CS 11.8.0 6d92aa1cf0a042e506189b6739e03a8b45e20ee7 (Optimized)

      Core was generated by `/test/MDEV-35504_MD100125-mariadb-11.8.0-linux-x86_64-opt/bin/mariadbd --no-def'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  list_add (root=0x14bc24021480, element=0x14bc2404e280)at /test/bb-11.8-MDEV-35504-opt-hints_opt/mysys/list.c:34
       
      [Current thread is 1 (LWP 491630)]
      (gdb) bt
      #0  list_add (root=0x14bc24021480, element=0x14bc2404e280)at /test/bb-11.8-MDEV-35504-opt-hints_opt/mysys/list.c:34
      #1  0x000055aa4d0975aa in heap_open (name=<optimized out>, mode=<optimized out>)at /test/bb-11.8-MDEV-35504-opt-hints_opt/storage/heap/hp_open.c:124
      #2  0x000055aa4d093b11 in ha_heap::open (this=0x14bc240592f0, name=0x14bc24022430 "./test/t2", mode=2, test_if_locked=<optimized out>)at /test/bb-11.8-MDEV-35504-opt-hints_opt/storage/heap/ha_heap.cc:114
      #3  0x000055aa4cdcabe9 in handler::ha_open (this=0x14bc240592f0, table_arg=<optimized out>, name=0x14bc24022430 "./test/t2", mode=2, test_if_locked=18, mem_root=0x0, partitions_to_open=0x0)at /test/bb-11.8-MDEV-35504-opt-hints_opt/sql/handler.cc:3625
      #4  0x000055aa4cc45fea in open_table_from_share (thd=thd@entry=0x14bc24000c68, share=share@entry=0x14bc24021f20, alias=alias@entry=0x14bc24019060, db_stat=db_stat@entry=33, prgflag=prgflag@entry=8, ha_open_flags=<optimized out>, outparam=0x14bc24058a88, is_create_table=<optimized out>, partitions_to_open=0x0)at /test/bb-11.8-MDEV-35504-opt-hints_opt/sql/table.cc:4629
      #5  0x000055aa4cadf7b7 in open_table (thd=0x14bc24000c68, table_list=table_list@entry=0x14bc24019018, ot_ctx=ot_ctx@entry=0x14bc8c073b08)at /test/bb-11.8-MDEV-35504-opt-hints_opt/sql/sql_base.cc:2240
      #6  0x000055aa4cae25cf in open_and_process_table (thd=0x14bc24000c68, tables=0x14bc24019018, counter=0x14bc8c073dbc, flags=0, prelocking_strategy=0x14bc8c073ff0, ot_ctx=0x14bc8c073b08, has_prelocking_list=<optimized out>)at /test/bb-11.8-MDEV-35504-opt-hints_opt/sql/sql_base.cc:4178
      #7  open_tables (thd=thd@entry=0x14bc24000c68, options=@0x14bc24006590: {m_options = DDL_options_st::OPT_NONE}, start=start@entry=0x14bc8c073db0, counter=counter@entry=0x14bc8c073dbc, flags=flags@entry=0, prelocking_strategy=prelocking_strategy@entry=0x14bc8c073ff0)at /test/bb-11.8-MDEV-35504-opt-hints_opt/sql/sql_base.cc:4664
      #8  0x000055aa4cae3f34 in open_and_lock_tables (thd=0x14bc24021480, thd@entry=0x14bc24000c68, options=@0x14bc2404e280: {m_options = DDL_options_st::OPT_NONE}, tables=0x14bc24018298, derived=true, flags=4294967295, flags@entry=0, prelocking_strategy=0x0, prelocking_strategy@entry=0x14bc8c073ff0)at /test/bb-11.8-MDEV-35504-opt-hints_opt/sql/sql_base.cc:5633
      #9  0x000055aa4cb5759e in open_and_lock_tables (thd=0x14bc24000c68, tables=0x0, derived=true, flags=0)at /test/bb-11.8-MDEV-35504-opt-hints_opt/sql/sql_base.h:534
      #10 mysql_execute_command (thd=thd@entry=0x14bc24000c68, is_called_from_prepared_stmt=<optimized out>)at /test/bb-11.8-MDEV-35504-opt-hints_opt/sql/sql_parse.cc:4564
      #11 0x000055aa4cb50321 in mysql_parse (thd=thd@entry=0x14bc24000c68, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14bc8c074420)at /test/bb-11.8-MDEV-35504-opt-hints_opt/sql/sql_parse.cc:7901
      #12 0x000055aa4cb4e7b0 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14bc24000c68, packet=packet@entry=0x14bc240088d9 "INSERT INTO t2 SELECT * FROM t2", packet_length=packet_length@entry=31, blocking=true)at /test/bb-11.8-MDEV-35504-opt-hints_opt/sql/sql_parse.cc:1903
      #13 0x000055aa4cb50731 in do_command (thd=thd@entry=0x14bc24000c68, blocking=true)at /test/bb-11.8-MDEV-35504-opt-hints_opt/sql/sql_parse.cc:1416
      #14 0x000055aa4cc7b68d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55aa4f89d138, put_in_cache=true)at /test/bb-11.8-MDEV-35504-opt-hints_opt/sql/sql_connect.cc:1438
      #15 0x000055aa4cc7b44f in handle_one_connection (arg=arg@entry=0x55aa4f89d138)at /test/bb-11.8-MDEV-35504-opt-hints_opt/sql/sql_connect.cc:1350
      #16 0x000055aa4d0072d9 in pfs_spawn_thread (arg=0x55aa4f8c4138)at /test/bb-11.8-MDEV-35504-opt-hints_opt/storage/perfschema/pfs.cc:2198
      #17 0x000014bc8d09ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #18 0x000014bc8d129c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Note a release build is needed, it does not reproduce in debug builds:

      bb-11.8-MDEV-35504-opt-hints CS 11.8.0 6d92aa1cf0a042e506189b6739e03a8b45e20ee7 (Debug)

      11.8.0-dbg>INSERT INTO t2 SELECT * FROM t2;
      Query OK, 0 rows affected (0.000 sec)
      Records: 0  Duplicates: 0  Warnings: 0
      

      Also try removing the TEMPORARY clause.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Roel Roel Van de Paar
              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.