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

Server crashes in base_list_iterator::next upon 2nd execution of SP, LOCK/UNLOCK tables are involved

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 5.5(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL)
    • 10.4(EOL)
    • Locking, Stored routines
    • None

    Description

      CREATE TABLE t1 (a INT);
      CREATE TABLE t2 (b INT);
       
      CREATE PROCEDURE p() INSERT INTO t1 SELECT * FROM ( SELECT * FROM t1 ) AS sq;
       
      LOCK TABLE t2 WRITE;
      --error ER_TABLE_NOT_LOCKED
      CALL p;
      UNLOCK TABLES;
      CALL p;
       
      # Cleanup
      DROP PROCEDURE p;
      DROP TABLES t1, t2;
      

      10.4 37570e84

      #3  <signal handler called>
      #4  0x0000561a1538977c in base_list_iterator::next (this=0x7f5854243510) at /data/src/10.4/sql/sql_list.h:430
      #5  0x0000561a1538ef47 in List_iterator<Item>::operator++ (this=0x7f5854243510) at /data/src/10.4/sql/sql_list.h:544
      #6  0x0000561a155ad306 in TABLE_LIST::change_refs_to_fields (this=0x7f58381414d0) at /data/src/10.4/sql/table.cc:8978
      #7  0x0000561a153cc50f in find_dup_table (thd=0x7f5838000b00, table=0x7f5838188758, table_list=0x7f5838140638, check_flag=0) at /data/src/10.4/sql/sql_base.cc:1260
      #8  0x0000561a153cc6cc in unique_table (thd=0x7f5838000b00, table=0x7f5838188758, table_list=0x7f5838140638, check_flag=0) at /data/src/10.4/sql/sql_base.cc:1323
      #9  0x0000561a1542e8b5 in select_insert::prepare (this=0x7f5838186228, values=..., u=0x7f583813e6a0) at /data/src/10.4/sql/sql_insert.cc:3747
      #10 0x0000561a154bad2b in JOIN::prepare (this=0x7f58381862d8, tables_init=0x7f58381414d0, wild_num=1, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7f5838188e08, unit_arg=0x7f583813e6a0) at /data/src/10.4/sql/sql_select.cc:1436
      #11 0x0000561a154c645d in mysql_select (thd=0x7f5838000b00, tables=0x7f58381414d0, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=3489926912, result=0x7f5838186228, unit=0x7f583813e6a0, select_lex=0x7f5838188e08) at /data/src/10.4/sql/sql_select.cc:4563
      #12 0x0000561a154b6584 in handle_select (thd=0x7f5838000b00, lex=0x7f583813e5d8, result=0x7f5838186228, setup_tables_done_option=1073741824) at /data/src/10.4/sql/sql_select.cc:420
      #13 0x0000561a154753c1 in mysql_execute_command (thd=0x7f5838000b00) at /data/src/10.4/sql/sql_parse.cc:4638
      #14 0x0000561a153848de in sp_instr_stmt::exec_core (this=0x7f5838140108, thd=0x7f5838000b00, nextp=0x7f58542446b4) at /data/src/10.4/sql/sp_head.cc:3670
      #15 0x0000561a15383c37 in sp_lex_keeper::reset_lex_and_exec_core (this=0x7f5838140150, thd=0x7f5838000b00, nextp=0x7f58542446b4, open_tables=false, instr=0x7f5838140108) at /data/src/10.4/sql/sp_head.cc:3398
      #16 0x0000561a153844a2 in sp_instr_stmt::execute (this=0x7f5838140108, thd=0x7f5838000b00, nextp=0x7f58542446b4) at /data/src/10.4/sql/sp_head.cc:3576
      #17 0x0000561a1537db47 in sp_head::execute (this=0x7f58381879f8, thd=0x7f5838000b00, merge_da_on_success=true) at /data/src/10.4/sql/sp_head.cc:1346
      #18 0x0000561a1538097b in sp_head::execute_procedure (this=0x7f58381879f8, thd=0x7f5838000b00, args=0x7f58380058e8) at /data/src/10.4/sql/sp_head.cc:2351
      #19 0x0000561a1546fb37 in do_execute_sp (thd=0x7f5838000b00, sp=0x7f58381879f8) at /data/src/10.4/sql/sql_parse.cc:3014
      #20 0x0000561a1547081e in Sql_cmd_call::execute (this=0x7f58380131d0, thd=0x7f5838000b00) at /data/src/10.4/sql/sql_parse.cc:3256
      #21 0x0000561a1547bb13 in mysql_execute_command (thd=0x7f5838000b00) at /data/src/10.4/sql/sql_parse.cc:6094
      #22 0x0000561a154811e7 in mysql_parse (thd=0x7f5838000b00, rawbuf=0x7f5838013128 "CALL p", length=6, parser_state=0x7f5854246170, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7912
      #23 0x0000561a1546c47a in dispatch_command (command=COM_QUERY, thd=0x7f5838000b00, packet=0x7f5838008331 "CALL p", packet_length=6, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1841
      #24 0x0000561a1546ab07 in do_command (thd=0x7f5838000b00) at /data/src/10.4/sql/sql_parse.cc:1359
      #25 0x0000561a155f21bb in do_handle_one_connection (connect=0x561a197dabc0) at /data/src/10.4/sql/sql_connect.cc:1412
      #26 0x0000561a155f1f0a in handle_one_connection (arg=0x561a197dabc0) at /data/src/10.4/sql/sql_connect.cc:1316
      #27 0x0000561a15ff1209 in pfs_spawn_thread (arg=0x561a197f6650) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #28 0x00007f585ac444a4 in start_thread (arg=0x7f5854247700) at pthread_create.c:456
      #29 0x00007f585918bd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      All of 5.5-10.5, debug, non-debug and ASAN builds crash the same way.

      Attachments

        Issue Links

          Activity

            People

              shulga Dmitry Shulga
              elenst Elena Stepanova
              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.