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

Assertion `!table->pos_in_locked_tables' failed in tc_release_table upon concurrent DML and FLUSH

    XMLWordPrintable

Details

    Description

      Notes:

      • Since it's only reproducible on 10.1 (at least with the provided test case), and there is no obvious harm on a non-debug build, it does not seem important to have it fixed. But it needs to be filed.
      • The test case is obviously non-deterministic. It fails for me on the 1st or 2nd loop, but it can vary on different machines and builds. Adjust the number of loops and rows if necessary.

      --source include/have_partition.inc
      --source include/have_sequence.inc
       
      SET max_statement_time= 5;
       
      CREATE TABLE t1 (a DATETIME) ENGINE=MyISAM PARTITION BY HASH(YEAR(a));
      CREATE TABLE t2 (b INT) ENGINE=MyISAM;
      CREATE TABLE t3 (c INT) ENGINE=MyISAM;
      INSERT INTO t3 SELECT seq FROM seq_1_to_1000000;
       
      --connect (con1,localhost,root,,test)
      --let $run= 5
      SET lock_wait_timeout= 1;
       
      while ($run)
      {
          --echo #
          --echo # $run runs left
          --echo #
          --connection con1
          LOCK TABLES t1 WRITE, t2 WRITE;
          --connection default
          --send
              INSERT INTO t3 SELECT * FROM t3;
          --connection con1
          --send
              FLUSH TABLES;
          --connection default
          --error 0,ER_STATEMENT_TIMEOUT
          --reap
          --connection con1
          --error 0,ER_LOCK_WAIT_TIMEOUT
          --reap
          UNLOCK TABLES;
          --dec $run
      }
       
      # Cleanup
      --disconnect con1
      --connection default
      DROP TABLE t1, t2, t3;
      

      10.1 0b36c27e

      mysqld: /data/src/10.1/sql/table_cache.cc:331: bool tc_release_table(TABLE*): Assertion `!table->pos_in_locked_tables' failed.
      200207  2:56:09 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f5cb30f8f12 in __GI___assert_fail (assertion=0x55a9f0b479f9 "!table->pos_in_locked_tables", file=0x55a9f0b479a8 "/data/src/10.1/sql/table_cache.cc", line=331, function=0x55a9f0b47e80 <tc_release_table(TABLE*)::__PRETTY_FUNCTION__> "bool tc_release_table(TABLE*)") at assert.c:101
      #8  0x000055a9f032ab23 in tc_release_table (table=0x7f5caa8afe70) at /data/src/10.1/sql/table_cache.cc:331
      #9  0x000055a9f00f40d5 in close_thread_table (thd=0x7f5cac3d1070, table_ptr=0x7f5cac3d1130) at /data/src/10.1/sql/sql_base.cc:1091
      #10 0x000055a9f00f7c1f in Locked_tables_list::unlink_all_closed_tables (this=0x7f5cac3d4a28, thd=0x7f5cac3d1070, lock=0x0, reopen_count=0) at /data/src/10.1/sql/sql_base.cc:3030
      #11 0x000055a9f00f7e61 in Locked_tables_list::reopen_tables (this=0x7f5cac3d4a28, thd=0x7f5cac3d1070, need_reopen=false) at /data/src/10.1/sql/sql_base.cc:3097
      #12 0x000055a9f00f31fe in close_cached_tables (thd=0x7f5cac3d1070, tables=0x0, wait_for_refresh=true, timeout=1) at /data/src/10.1/sql/sql_base.cc:596
      #13 0x000055a9f02cae5a in reload_acl_and_cache (thd=0x7f5cac3d1070, options=4, tables=0x0, write_to_binlog=0x7f5cb4cd9970) at /data/src/10.1/sql/sql_reload.cc:343
      #14 0x000055a9f0164ecb in mysql_execute_command (thd=0x7f5cac3d1070) at /data/src/10.1/sql/sql_parse.cc:4628
      #15 0x000055a9f016c761 in mysql_parse (thd=0x7f5cac3d1070, rawbuf=0x7f5caa821088 "FLUSH TABLES", length=12, parser_state=0x7f5cb4cda1e0) at /data/src/10.1/sql/sql_parse.cc:7209
      #16 0x000055a9f015b93b in dispatch_command (command=COM_QUERY, thd=0x7f5cac3d1070, packet=0x7f5cac3d7071 "FLUSH TABLES", packet_length=12) at /data/src/10.1/sql/sql_parse.cc:1499
      #17 0x000055a9f015a6f9 in do_command (thd=0x7f5cac3d1070) at /data/src/10.1/sql/sql_parse.cc:1131
      #18 0x000055a9f0297ae3 in do_handle_one_connection (thd_arg=0x7f5cac3d1070) at /data/src/10.1/sql/sql_connect.cc:1331
      #19 0x000055a9f0297814 in handle_one_connection (arg=0x7f5cac3d1070) at /data/src/10.1/sql/sql_connect.cc:1242
      #20 0x000055a9f06bd76e in pfs_spawn_thread (arg=0x7f5cb283a670) at /data/src/10.1/storage/perfschema/pfs.cc:1868
      #21 0x00007f5cb49a74a4 in start_thread (arg=0x7f5cb4cdb700) at pthread_create.c:456
      #22 0x00007f5cb31b5d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Not reproducible on 10.2-10.5.

      Attachments

        Activity

          People

            Unassigned Unassigned
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.