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

Assertion `m_lock_type == 2' failed in int handler::ha_close()

    XMLWordPrintable

Details

    Description

      DELIMITER $$;
      CREATE PROCEDURE p1()
      BEGIN
        DECLARE r ROW TYPE OF t1 DEFAULT 1;
        SELECT r.a, r.b;
      END;
      $$
      DELIMITER ;$$
      CREATE TEMPORARY TABLE t1 (c DECIMAL);
      LOCK TABLE t1 READ;
      ALTER TABLE t1 CHANGE c CC INT,ALGORITHM=INPLACE;
      CALL p1();
      

      Leads to:

      CS 10.5.27 95885261f0ff70e563140f5fb94da134b84d79b4 (Debug)

      mariadbd: /test/10.5_dbg/sql/handler.cc:3171: int handler::ha_close(): Assertion `m_lock_type == 2' failed.
      

      CS 10.5.27 95885261f0ff70e563140f5fb94da134b84d79b4 (Debug)

      Core was generated by `/test/MD130924-mariadb-10.5.27-linux-x86_64-dbg/bin/mariadbd --no-defaults --ma'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      [Current thread is 1 (Thread 0x146b180c3700 (LWP 1862063))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x0000146b211c9859 in __GI_abort () at abort.c:79
      #2  0x0000146b211c9729 in __assert_fail_base (fmt=0x146b2135f588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55f6b7881143 "m_lock_type == 2", file=0x55f6b7880bcf "/test/10.5_dbg/sql/handler.cc", line=3171, function=<optimized out>) at assert.c:92
      #3  0x0000146b211dafd6 in __GI___assert_fail (assertion=assertion@entry=0x55f6b7881143 "m_lock_type == 2", file=file@entry=0x55f6b7880bcf "/test/10.5_dbg/sql/handler.cc", line=line@entry=3171, function=function@entry=0x55f6b7881114 "int handler::ha_close()") at assert.c:101
      #4  0x000055f6b6c9732b in handler::ha_close (this=0x146a88020f60) at /test/10.5_dbg/sql/handler.cc:3171
      #5  0x000055f6b6ac88cb in closefrm (table=table@entry=0x146a88020b38) at /test/10.5_dbg/sql/table.cc:4424
      #6  0x000055f6b6bf5dd1 in THD::close_temporary_table (this=this@entry=0x146a88000d48, table=table@entry=0x146a88020b38) at /test/10.5_dbg/sql/temporary_tables.cc:1248
      #7  0x000055f6b6bf67cb in THD::free_temporary_table (this=this@entry=0x146a88000d48, table=table@entry=0x146a88020b38) at /test/10.5_dbg/sql/temporary_tables.cc:1499
      #8  0x000055f6b6bf7904 in THD::find_temporary_table (this=this@entry=0x146a88000d48, key=key@entry=0x146b180bf480 "test", key_length=16, state=state@entry=THD::TMP_TABLE_NOT_IN_USE) at /test/10.5_dbg/sql/temporary_tables.cc:1080
      #9  0x000055f6b6bf7a39 in THD::find_and_use_tmp_table (this=this@entry=0x146a88000d48, tl=tl@entry=0x146a88013fb8, out_table=out_table@entry=0x146b180bf658) at /test/10.5_dbg/sql/temporary_tables.cc:1178
      #10 0x000055f6b6bf7c4f in THD::open_temporary_table (this=this@entry=0x146a88000d48, tl=tl@entry=0x146a88013fb8) at /test/10.5_dbg/sql/temporary_tables.cc:379
      #11 0x000055f6b6bf80ad in THD::open_temporary_tables (this=this@entry=0x146a88000d48, tl=tl@entry=0x146a88013fb8) at /test/10.5_dbg/sql/temporary_tables.cc:476
      #12 0x000055f6b6946b92 in open_tables_only_view_structure (thd=thd@entry=0x146a88000d48, table_list=table_list@entry=0x146a88013fb8, can_deadlock=<optimized out>) at /test/10.5_dbg/sql/sql_base.cc:5364
      #13 0x000055f6b690cb4b in Table_ident::resolve_table_rowtype_ref (this=0x146a880408f8, thd=thd@entry=0x146a88000d48, defs=@0x146b180c1410: {<List<Spvar_definition>> = {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55f6b8035520 <end_of_list>, last = 0x146b180c1410, elements = 0}, <No data fields>}, <No data fields>}) at /test/10.5_dbg/sql/sql_plist.h:82
      #14 0x000055f6b690d3c0 in sp_rcontext::init_var_items (this=this@entry=0x146a880132c8, thd=thd@entry=0x146a88000d48, field_def_lst=@0x146b180c1510: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x146a880132b8, last = 0x146a880132b8, elements = 1}, <No data fields>}) at /test/10.5_dbg/sql/field.h:5598
      #15 0x000055f6b690dae6 in sp_rcontext::create (thd=thd@entry=0x146a88000d48, owner=owner@entry=0x146a8803f7c0, root_parsing_ctx=0x146a88040118, return_value_fld=return_value_fld@entry=0x0, field_def_lst=@0x146b180c1510: {<List<Spvar_definition>> = {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x146a880132b8, last = 0x146a880132b8, elements = 1}, <No data fields>}, <No data fields>}) at /test/10.5_dbg/sql/sp_rcontext.cc:119
      #16 0x000055f6b68fd288 in sp_head::rcontext_create (this=this@entry=0x146a8803f7c0, thd=thd@entry=0x146a88000d48, ret_value=ret_value@entry=0x0, defs=defs@entry=0x146b180c1510, switch_security_ctx=switch_security_ctx@entry=true) at /test/10.5_dbg/sql/sp_head.cc:1811
      #17 0x000055f6b68fd310 in sp_head::rcontext_create (this=this@entry=0x146a8803f7c0, thd=thd@entry=0x146a88000d48, ret_value=ret_value@entry=0x0, args=args@entry=0x146a88005e58) at /test/10.5_dbg/sql/sp_head.cc:1828
      #18 0x000055f6b6902741 in sp_head::execute_procedure (this=0x146a8803f7c0, thd=thd@entry=0x146a88000d48, args=0x146a88005e58) at /test/10.5_dbg/sql/sp_head.cc:2306
      #19 0x000055f6b69bd659 in do_execute_sp (thd=thd@entry=0x146a88000d48, sp=sp@entry=0x146a8803f7c0) at /test/10.5_dbg/sql/sql_parse.cc:3111
      #20 0x000055f6b69c3154 in Sql_cmd_call::execute (this=0x146a88012e68, thd=0x146a88000d48) at /test/10.5_dbg/sql/sql_parse.cc:3357
      #21 0x000055f6b69d0b89 in mysql_execute_command (thd=thd@entry=0x146a88000d48) at /test/10.5_dbg/sql/sql_parse.cc:6180
      #22 0x000055f6b69b7420 in mysql_parse (thd=thd@entry=0x146a88000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x146b180c22c0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:8236
      #23 0x000055f6b69c6165 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x146a88000d48, packet=packet@entry=0x146a8800aa19 "CALL p1()", packet_length=packet_length@entry=9, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_class.h:1329
      #24 0x000055f6b69c8e9e in do_command (thd=0x146a88000d48) at /test/10.5_dbg/sql/sql_parse.cc:1376
      #25 0x000055f6b6b162f2 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55f6bad59a28, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1417
      #26 0x000055f6b6b16990 in handle_one_connection (arg=arg@entry=0x55f6bad59a28) at /test/10.5_dbg/sql/sql_connect.cc:1319
      #27 0x000055f6b6f97bb9 in pfs_spawn_thread (arg=0x55f6bad76ea8) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
      #28 0x0000146b216da609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #29 0x0000146b212c6133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.5.27 (dbg), 10.6.20 (dbg), 10.11.10 (dbg), 11.1.7 (dbg), 11.2.6 (dbg), 11.4.4 (dbg), 11.6.0 (dbg), 11.7.0 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.5.27 (opt), 10.6.20 (opt), 10.11.10 (opt), 11.1.7 (opt), 11.2.6 (opt), 11.4.4 (opt), 11.6.0 (opt), 11.7.0 (opt)

      Attachments

        Activity

          People

            bar Alexander Barkov
            ramesh Ramesh Sivaraman
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.