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

Deadlock and eventual Assertion `!table->pos_in_locked_tables' failed in tc_release_table on KILL_TIMEOUT

    Details

      Description

      SET max_statement_time= 2;
       
      CREATE TABLE t1 (a INT);
      CREATE VIEW v1 AS SELECT * FROM t1;
      CREATE TABLE t2 (b INT, c INT);
       
      LOCK TABLES v1 READ, t2 WRITE, t1 WRITE;
      --error ER_BAD_FIELD_ERROR
      ALTER TABLE t1 CHANGE f1 f2 DOUBLE;
      ALTER TABLE t2 DROP c;
       
      # Cleanup
      UNLOCK TABLES;
      DROP VIEW v1;
      DROP TABLE t1, t2;
      

      Execution hangs on the 2nd ALTER, which eventually gets interrupted due to max_statement_time, at which point the assertion failure happens:

      10.2 4ca20791

      mysqld: /data/src/10.2/sql/table_cache.cc:453: void tc_release_table(TABLE*): Assertion `!table->pos_in_locked_tables' failed.
      190304 16:49:17 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fe272366ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x000055c7d1435bdd in tc_release_table (table=0x7fe22008fdc0) at /data/src/10.2/sql/table_cache.cc:453
      #9  0x000055c7d11cd312 in close_thread_table (thd=0x7fe220000b00, table_ptr=0x7fe220000be0) at /data/src/10.2/sql/sql_base.cc:903
      #10 0x000055c7d11cfd8f in Locked_tables_list::unlink_all_closed_tables (this=0x7fe220004568, thd=0x7fe220000b00, lock=0x0, reopen_count=1) at /data/src/10.2/sql/sql_base.cc:2367
      #11 0x000055c7d11d015c in Locked_tables_list::reopen_tables (this=0x7fe220004568, thd=0x7fe220000b00, need_reopen=false) at /data/src/10.2/sql/sql_base.cc:2464
      #12 0x000055c7d131a0b0 in mysql_alter_table (thd=0x7fe220000b00, new_db=0x7fe220012b50 "test", new_name=0x0, create_info=0x7fe26478ee50, table_list=0x7fe220012540, alter_info=0x7fe26478eda0, order_num=0, order=0x0, ignore=false) at /data/src/10.2/sql/sql_table.cc:9765
      #13 0x000055c7d13947e9 in Sql_cmd_alter_table::execute (this=0x7fe220012b80, thd=0x7fe220000b00) at /data/src/10.2/sql/sql_alter.cc:329
      #14 0x000055c7d124aeb4 in mysql_execute_command (thd=0x7fe220000b00) at /data/src/10.2/sql/sql_parse.cc:6231
      #15 0x000055c7d124fd15 in mysql_parse (thd=0x7fe220000b00, rawbuf=0x7fe220012468 "ALTER TABLE t2 DROP c", length=21, parser_state=0x7fe264790200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:8018
      #16 0x000055c7d123d64f in dispatch_command (command=COM_QUERY, thd=0x7fe220000b00, packet=0x7fe220096191 "", packet_length=21, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1829
      #17 0x000055c7d123bf5a in do_command (thd=0x7fe220000b00) at /data/src/10.2/sql/sql_parse.cc:1379
      #18 0x000055c7d138f480 in do_handle_one_connection (connect=0x55c7d387bee0) at /data/src/10.2/sql/sql_connect.cc:1336
      #19 0x000055c7d138f20d in handle_one_connection (arg=0x55c7d387bee0) at /data/src/10.2/sql/sql_connect.cc:1242
      #20 0x000055c7d17b7200 in pfs_spawn_thread (arg=0x55c7d389f0f0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #21 0x00007fe27403d494 in start_thread (arg=0x7fe264791700) at pthread_create.c:333
      #22 0x00007fe27242393f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Non-debug doesn't crash, but ALTER still hangs.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                monty Michael Widenius
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: