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

Server crash in close_thread_table or Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->s->db.str, table->s->table_name.str, MDL_SHARED)' upon CREATE OR REPLACE TABLE under lock

    XMLWordPrintable

Details

    Description

      The assertion looks like MDEV-19273, but the rest – the location, scenario, affected versions – are completely different.

      SET sql_mode= 'STRICT_TRANS_TABLES'; # Only needed for 10.1, in higher versions it is default
       
      CREATE TABLE t1 (a INT);
      LOCK TABLE t1 WRITE;
       
      --error ER_DATA_TOO_LONG
      CREATE OR REPLACE TABLE t1 (a CHAR(1)) AS SELECT 'foo' AS a;
       
      # Cleanup
      DROP TABLE t1;
      

      10.2 release 5f1ec5cb

      #3  <signal handler called>
      #4  close_thread_table (thd=thd@entry=0x7fa8d80009a8, table_ptr=table_ptr@entry=0x7fa8d8000a88) at /data/src/10.2/sql/sql_base.cc:886
      #5  0x0000560bb5d11e6c in drop_open_table (thd=0x7fa8d80009a8, table=<optimized out>, db_name=0x7fa8d800f808 "test", table_name=0x7fa8d800f1a0 "t1") at /data/src/10.2/sql/sql_base.cc:1272
      #6  0x0000560bb5d3d7ce in select_create::abort_result_set (this=0x7fa8d800faa0) at /data/src/10.2/sql/sql_insert.cc:4721
      #7  0x0000560bb5db2e5a in handle_select (thd=thd@entry=0x7fa8d80009a8, lex=lex@entry=0x7fa8d8004320, result=result@entry=0x7fa8d800faa0, setup_tables_done_option=setup_tables_done_option@entry=0) at /data/src/10.2/sql/sql_select.cc:379
      #8  0x0000560bb5de6ed3 in Sql_cmd_create_table::execute (this=<optimized out>, thd=0x7fa8d80009a8) at /data/src/10.2/sql/sql_table.cc:10943
      #9  0x0000560bb5d5c44a in mysql_execute_command (thd=thd@entry=0x7fa8d80009a8) at /data/src/10.2/sql/sql_parse.cc:5964
      #10 0x0000560bb5d6370e in mysql_parse (thd=thd@entry=0x7fa8d80009a8, rawbuf=<optimized out>, length=59, parser_state=parser_state@entry=0x7fa92c93d620, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.2/sql/sql_parse.cc:7733
      #11 0x0000560bb5d65fa0 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7fa8d80009a8, packet=packet@entry=0x7fa8d8006d09 "CREATE OR REPLACE TABLE t1 (a CHAR(1)) AS SELECT 'foo' AS a", packet_length=packet_length@entry=59, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.2/sql/sql_parse.cc:1824
      #12 0x0000560bb5d66d60 in do_command (thd=0x7fa8d80009a8) at /data/src/10.2/sql/sql_parse.cc:1377
      #13 0x0000560bb5e33682 in do_handle_one_connection (connect=connect@entry=0x560bb8d97d88) at /data/src/10.2/sql/sql_connect.cc:1336
      #14 0x0000560bb5e337dd in handle_one_connection (arg=arg@entry=0x560bb8d97d88) at /data/src/10.2/sql/sql_connect.cc:1241
      #15 0x0000560bb63f4f01 in pfs_spawn_thread (arg=0x560bb8d97fe8) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #16 0x00007fa9335124a4 in start_thread (arg=0x7fa92c93e700) at pthread_create.c:456
      #17 0x00007fa932590d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      10.2 debug 6e09e7c1

      mysqld: /data/src/10.2/sql/sql_base.cc:883: void close_thread_table(THD*, TABLE**): Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->s->db.str, table->s->table_name.str, MDL_SHARED)' failed.
      200803 21:45:23 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fdc12548f12 in __GI___assert_fail (assertion=0x555b6fc8db78 "thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->s->db.str, table->s->table_name.str, MDL_SHARED)", file=0x555b6fc8d830 "/data/src/10.2/sql/sql_base.cc", line=883, function=0x555b6fc8f3a0 <close_thread_table(THD*, TABLE**)::__PRETTY_FUNCTION__> "void close_thread_table(THD*, TABLE**)") at assert.c:101
      #8  0x0000555b6f1a62e6 in close_thread_table (thd=0x7fdbfc000af0, table_ptr=0x7fdbfc000bd0) at /data/src/10.2/sql/sql_base.cc:880
      #9  0x0000555b6f1a6150 in close_thread_tables (thd=0x7fdbfc000af0) at /data/src/10.2/sql/sql_base.cc:859
      #10 0x0000555b6f1a8c2f in Locked_tables_list::unlock_locked_tables (this=0x7fdbfc004558, thd=0x7fdbfc000af0) at /data/src/10.2/sql/sql_base.cc:2219
      #11 0x0000555b6f1a8ca9 in Locked_tables_list::unlock_locked_table (this=0x7fdbfc004558, thd=0x7fdbfc000af0, mdl_ticket=0x7fdbfc010d70) at /data/src/10.2/sql/sql_base.cc:2261
      #12 0x0000555b6f1ff49a in select_create::abort_result_set (this=0x7fdbfc012e48) at /data/src/10.2/sql/sql_insert.cc:4694
      #13 0x0000555b6f257b24 in handle_select (thd=0x7fdbfc000af0, lex=0x7fdbfc004628, result=0x7fdbfc012e48, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:379
      #14 0x0000555b6f2f6edd in Sql_cmd_create_table::execute (this=0x7fdbfc012578, thd=0x7fdbfc000af0) at /data/src/10.2/sql/sql_table.cc:10944
      #15 0x0000555b6f2222a2 in mysql_execute_command (thd=0x7fdbfc000af0) at /data/src/10.2/sql/sql_parse.cc:5964
      #16 0x0000555b6f227223 in mysql_parse (thd=0x7fdbfc000af0, rawbuf=0x7fdbfc012458 "CREATE OR REPLACE TABLE t1 (a CHAR(1)) AS SELECT 'foo' AS a", length=59, parser_state=0x7fdc0c87c610, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7733
      #17 0x0000555b6f21554f in dispatch_command (command=COM_QUERY, thd=0x7fdbfc000af0, packet=0x7fdbfc08d321 "CREATE OR REPLACE TABLE t1 (a CHAR(1)) AS SELECT 'foo' AS a", packet_length=59, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1824
      #18 0x0000555b6f213fca in do_command (thd=0x7fdbfc000af0) at /data/src/10.2/sql/sql_parse.cc:1377
      #19 0x0000555b6f36a099 in do_handle_one_connection (connect=0x555b72996cf0) at /data/src/10.2/sql/sql_connect.cc:1336
      #20 0x0000555b6f369e04 in handle_one_connection (arg=0x555b72996cf0) at /data/src/10.2/sql/sql_connect.cc:1241
      #21 0x0000555b6fb80aa8 in pfs_spawn_thread (arg=0x555b729a1ae0) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #22 0x00007fdc144d14a4 in start_thread (arg=0x7fdc0c87d700) at pthread_create.c:456
      #23 0x00007fdc12605d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible on 10.1-10.5 with at least MyISAM, InnoDB, Aria, on debug and non-debug builds as described

      Attachments

        Activity

          People

            wlad Vladislav Vaintroub
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            6 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.