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

Assertion `!trx_free || !trx->locked_connections' failed in spider_free_trx_conn on LOCK TABLES

Details

    Description

      INSTALL PLUGIN Spider SONAME 'ha_spider.so';
      CREATE USER Spider@localhost IDENTIFIED BY 'PWD123';
      CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET '../socket.sock',DATABASE 'test',user 'Spider',PASSWORD 'PWD123');
      CREATE TABLE t (c INT) ENGINE=InnoDB;
      CREATE TABLE t1 (c1 INT) ENGINE=Spider;
      CREATE TABLE t2 (f1 INT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"';
      LOCK TABLES t2 WRITE;
      LOCK TABLES t1 READ,t2 READ;
      

      Leads to:

      10.11.0 bc563f1a4b0b38de3b41fd0f0d3d8b7f1aacbd8b (Debug)

      mysqld: /test/10.11_dbg/storage/spider/spd_trx.cc:101: int spider_free_trx_conn(SPIDER_TRX*, bool): Assertion `!trx_free || !trx->locked_connections' failed.
      

      10.11.0 bc563f1a4b0b38de3b41fd0f0d3d8b7f1aacbd8b (Debug)

      Core was generated by `/test/MD190822-mariadb-10.11.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
      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 0x1470500a0700 (LWP 184539))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x0000147069c23859 in __GI_abort () at abort.c:79
      #2  0x0000147069c23729 in __assert_fail_base (fmt=0x147069db9588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x1470275bec08 "!trx_free || !trx->locked_connections", file=0x1470275beba8 "/test/10.11_dbg/storage/spider/spd_trx.cc", line=101, function=<optimized out>) at assert.c:92
      #3  0x0000147069c34fd6 in __GI___assert_fail (assertion=assertion@entry=0x1470275bec08 "!trx_free || !trx->locked_connections", file=file@entry=0x1470275beba8 "/test/10.11_dbg/storage/spider/spd_trx.cc", line=line@entry=101, function=function@entry=0x1470275bebd8 "int spider_free_trx_conn(SPIDER_TRX*, bool)") at assert.c:101
      #4  0x00001470274e8d6c in spider_free_trx_conn (trx=trx@entry=0x146fd0061948, trx_free=trx_free@entry=true) at /test/10.11_dbg/storage/spider/spd_trx.cc:101
      #5  0x00001470274efc57 in spider_free_trx_alloc (trx=trx@entry=0x146fd0061948) at /test/10.11_dbg/storage/spider/spd_trx.cc:1138
      #6  0x00001470274efe6b in spider_free_trx (trx=trx@entry=0x146fd0061948, need_lock=need_lock@entry=true, reset_ha_data=reset_ha_data@entry=false) at /test/10.11_dbg/storage/spider/spd_trx.cc:1455
      #7  0x000014702751c2ff in spider_close_connection (hton=<optimized out>, thd=0x146fd0000db8) at /test/10.11_dbg/storage/spider/spd_table.cc:6313
      #8  0x00005654cdcf410e in ha_close_connection (thd=thd@entry=0x146fd0000db8) at /test/10.11_dbg/sql/handler.cc:906
      #9  0x00005654cd99e0a5 in THD::free_connection (this=this@entry=0x146fd0000db8) at /test/10.11_dbg/sql/sql_class.cc:1598
      #10 0x00005654cd8d31bc in unlink_thd (thd=0x146fd0000db8) at /test/10.11_dbg/sql/mysqld.cc:2765
      #11 0x00005654cdb6c3b4 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5654d18394d8, put_in_cache=put_in_cache@entry=true) at /test/10.11_dbg/sql/sql_connect.cc:1429
      #12 0x00005654cdb6c6e3 in handle_one_connection (arg=0x5654d18394d8) at /test/10.11_dbg/sql/sql_connect.cc:1312
      #13 0x000014706a134609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #14 0x0000147069d20133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.5.18 (dbg), 10.6.10 (dbg), 10.7.6 (dbg), 10.8.5 (dbg), 10.9.2 (dbg), 10.10.2 (dbg), 10.11.0 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.4.27 (dbg), 10.4.27 (opt), 10.5.18 (opt), 10.6.10 (opt), 10.7.6 (opt), 10.8.5 (opt), 10.9.2 (opt), 10.10.2 (opt), 10.11.0 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.38 (dbg), 5.7.38 (opt), 8.0.29 (dbg), 8.0.29 (opt)

      Attachments

        Issue Links

          Activity

            The following assertion in spider_free_trx_conn() has been added by my recent commit. It holds in many cases, but it doesn't hold for the case when the connection to a remote data node is disconnected.

             DBUG_ASSERT(!trx_free || !trx->locked_connections);
            

            nayuta-yanagisawa Nayuta Yanagisawa (Inactive) added a comment - The following assertion in spider_free_trx_conn() has been added by my recent commit. It holds in many cases, but it doesn't hold for the case when the connection to a remote data node is disconnected. DBUG_ASSERT(!trx_free || !trx->locked_connections);

            However, even though I remove the assertion, the test case result in a hang. According to the debug trace, the hang seems to occur at Query_cache::lock_and_suspend().

            ...
            T@1    : | | | | | | | | | | | | | <ma_commit
            T@1    : | | | | | | | | | | | | | >reset_thd_trn
            T@1    : | | | | | | | | | | | | | | mutex: LOCK_thd_data (0x55fae5b020f8) locking
            T@1    : | | | | | | | | | | | | | | mutex: LOCK_thd_data (0x55fae5b020f8) locked
            T@1    : | | | | | | | | | | | | | | mutex: LOCK_thd_data (0x55fae5b020f8) unlocking
            T@1    : | | | | | | | | | | | | | | >plugin_unlock
            T@1    : | | | | | | | | | | | | | | | mutex: LOCK_plugin (0x55fae3d23060) locking
            T@1    : | | | | | | | | | | | | | | | mutex: LOCK_plugin (0x55fae3d23060) locked
            T@1    : | | | | | | | | | | | | | | | >intern_plugin_unlock
            T@1    : | | | | | | | | | | | | | | | | >my_free
            T@1    : | | | | | | | | | | | | | | | | | my: ptr: 0x7f844c0e9ae8
            T@1    : | | | | | | | | | | | | | | | | | info: global thd memory_used: -73984  size: -32
            T@1    : | | | | | | | | | | | | | | | | <my_free
            T@1    : | | | | | | | | | | | | | | | | lock: thd: 0x55fae5b00398  plugin: "Aria" UNLOCK ref_count: 3
            T@1    : | | | | | | | | | | | | | | | <intern_plugin_unlock
            T@1    : | | | | | | | | | | | | | | | mutex: LOCK_plugin (0x55fae3d23060) unlocking
            T@1    : | | | | | | | | | | | | | | <plugin_unlock
            T@1    : | | | | | | | | | | | | | | info: table: 0x55fae5cb7d88  trn: 0x7f843c01c128 -> NULL
            T@1    : | | | | | | | | | | | | | | >Query_cache::invalidate_by_MyISAM_filename
            T@1    : | | | | | | | | | | | | | | <Query_cache::invalidate_by_MyISAM_filename
            T@1    : | | | | | | | | | | | | | | >check_integrity
            T@1    : | | | | | | | | | | | | | | | THD::enter_stage: Waiting for query cache lock at /home/nayuta_mariadb/repo/mariadb-server/bb-10.5-MDEV-29484/sql/sql_cache.cc:692
            T@1    : | | | | | | | | | | | | | | | >Query_cache::lock_and_suspend
            T@1    : | | | | | | | | | | | | | | | | mutex: structure_guard_mutex (0x55fae3d1cd80) locking
            

            nayuta-yanagisawa Nayuta Yanagisawa (Inactive) added a comment - However, even though I remove the assertion, the test case result in a hang. According to the debug trace, the hang seems to occur at Query_cache::lock_and_suspend() . ... T@1 : | | | | | | | | | | | | | <ma_commit T@1 : | | | | | | | | | | | | | >reset_thd_trn T@1 : | | | | | | | | | | | | | | mutex: LOCK_thd_data (0x55fae5b020f8) locking T@1 : | | | | | | | | | | | | | | mutex: LOCK_thd_data (0x55fae5b020f8) locked T@1 : | | | | | | | | | | | | | | mutex: LOCK_thd_data (0x55fae5b020f8) unlocking T@1 : | | | | | | | | | | | | | | >plugin_unlock T@1 : | | | | | | | | | | | | | | | mutex: LOCK_plugin (0x55fae3d23060) locking T@1 : | | | | | | | | | | | | | | | mutex: LOCK_plugin (0x55fae3d23060) locked T@1 : | | | | | | | | | | | | | | | >intern_plugin_unlock T@1 : | | | | | | | | | | | | | | | | >my_free T@1 : | | | | | | | | | | | | | | | | | my: ptr: 0x7f844c0e9ae8 T@1 : | | | | | | | | | | | | | | | | | info: global thd memory_used: -73984 size: -32 T@1 : | | | | | | | | | | | | | | | | <my_free T@1 : | | | | | | | | | | | | | | | | lock: thd: 0x55fae5b00398 plugin: "Aria" UNLOCK ref_count: 3 T@1 : | | | | | | | | | | | | | | | <intern_plugin_unlock T@1 : | | | | | | | | | | | | | | | mutex: LOCK_plugin (0x55fae3d23060) unlocking T@1 : | | | | | | | | | | | | | | <plugin_unlock T@1 : | | | | | | | | | | | | | | info: table: 0x55fae5cb7d88 trn: 0x7f843c01c128 -> NULL T@1 : | | | | | | | | | | | | | | >Query_cache::invalidate_by_MyISAM_filename T@1 : | | | | | | | | | | | | | | <Query_cache::invalidate_by_MyISAM_filename T@1 : | | | | | | | | | | | | | | >check_integrity T@1 : | | | | | | | | | | | | | | | THD::enter_stage: Waiting for query cache lock at /home/nayuta_mariadb/repo/mariadb-server/bb-10.5-MDEV-29484/sql/sql_cache.cc:692 T@1 : | | | | | | | | | | | | | | | >Query_cache::lock_and_suspend T@1 : | | | | | | | | | | | | | | | | mutex: structure_guard_mutex (0x55fae3d1cd80) locking
            nayuta-yanagisawa Nayuta Yanagisawa (Inactive) added a comment - OK. The hang has been introduced by https://github.com/MariaDB/server/commit/a26700cca579926cddf9a48c45f13b32785746bb .
            nayuta-yanagisawa Nayuta Yanagisawa (Inactive) added a comment - - edited Please review: https://github.com/MariaDB/server/commit/1ae6d188c161cf07d0c389d5705b913b9504fc44

            ok to push.

            holyfoot Alexey Botchkov added a comment - ok to push.

            People

              nayuta-yanagisawa Nayuta Yanagisawa (Inactive)
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.