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

Assertion `!n_mysql_tables_in_use' failed in innobase_close_connection

Details

    Description

      Replay using the CLI. Deemed non-sporadic. Interestingly, the crash does not repeat on UBASAN builds (at all).

      INSTALL PLUGIN Spider SONAME 'ha_spider.so';
      CREATE USER Spider@localhost IDENTIFIED BY 'PWD1';
      CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET '../socket.sock',DATABASE 'test',user 'Spider',PASSWORD 'PWD1');
      CREATE TABLE t (c INT);
      CREATE TABLE t1 (c1 TEXT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"';
      CREATE OR REPLACE TABLE t2 AS SELECT FORMAT (c1,0) AS c1 FROM t1;  # 'OR REPLACE' is required
      # Exit the CLI here to trigger the bug
      

      Leads to:

      10.11.0 6ebdd3013a18b01dbecec76b870810329eb76586 (Debug)

      mysqld: /test/10.11_dbg/storage/innobase/trx/trx0trx.cc:377: void trx_t::free(): Assertion `!n_mysql_tables_in_use' failed.
      

      10.11.0 6ebdd3013a18b01dbecec76b870810329eb76586 (Debug)

      Core was generated by `/test/MD190922-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 0x1522fca0e700 (LWP 3124377))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x0000152315567859 in __GI_abort () at abort.c:79
      #2  0x0000152315567729 in __assert_fail_base (fmt=0x1523156fd588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x56248ffe99f0 "!n_mysql_tables_in_use", file=0x56248ffe9c08 "/test/10.11_dbg/storage/innobase/trx/trx0trx.cc", line=377, function=<optimized out>) at assert.c:92
      #3  0x0000152315578fd6 in __GI___assert_fail (assertion=assertion@entry=0x56248ffe99f0 "!n_mysql_tables_in_use", file=file@entry=0x56248ffe9c08 "/test/10.11_dbg/storage/innobase/trx/trx0trx.cc", line=line@entry=377, function=function@entry=0x56248ffe9a07 "void trx_t::free()") at assert.c:101
      #4  0x000056248f9b8b7d in trx_t::free (this=this@entry=0x15230ce01b80) at /test/10.11_dbg/storage/innobase/trx/trx0trx.cc:377
      #5  0x000056248f7797ce in innobase_close_connection (hton=<optimized out>, thd=0x1522c0000d48) at /test/10.11_dbg/storage/innobase/handler/ha_innodb.cc:4956
      #6  0x000056248f479f70 in ha_close_connection (thd=thd@entry=0x1522c0000d48) at /test/10.11_dbg/sql/handler.cc:906
      #7  0x000056248f120d55 in THD::free_connection (this=this@entry=0x1522c0000d48) at /test/10.11_dbg/sql/sql_class.cc:1599
      #8  0x000056248f05518e in unlink_thd (thd=0x1522c0000d48) at /test/10.11_dbg/sql/mysqld.cc:2766
      #9  0x000056248f2f2185 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x562492a89fc8, put_in_cache=put_in_cache@entry=true) at /test/10.11_dbg/sql/sql_connect.cc:1427
      #10 0x000056248f2f24c3 in handle_one_connection (arg=0x562492a89fc8) at /test/10.11_dbg/sql/sql_connect.cc:1318
      #11 0x0000152315a78609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #12 0x0000152315664133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Single error in client:

      10.11.0 6ebdd3013a18b01dbecec76b870810329eb76586 (Debug)

      10.11.0-dbg>CREATE OR REPLACE TABLE t2 AS SELECT FORMAT (c1,0) AS c1 FROM t1;  # 'OR REPLACE' is required
      ERROR 1054 (42S22): Unknown column 't0.c1' in 'field list'
      

      Bug confirmed present in:
      MariaDB: 10.11.0 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.3.37 (dbg), 10.3.37 (opt), 10.4.27 (dbg), 10.4.27 (opt), 10.5.18 (dbg), 10.5.18 (opt), 10.6.10 (dbg), 10.6.10 (opt), 10.7.6 (dbg), 10.7.6 (opt), 10.8.5 (dbg), 10.8.5 (opt), 10.9.3 (dbg), 10.9.3 (opt), 10.10.0 (opt), 10.10.2 (dbg), 10.10.0 (dbg), 10.10.2 (opt), 10.11.0 (opt)

      Attachments

        Issue Links

          Activity

            Please, add a non-debug test. using Spider or anything. We test with debug on one builder out of 47. So whenever possible we should try to create non-debug tests.

            There's an almost usable test in the bug description

            serg Sergei Golubchik added a comment - Please, add a non-debug test. using Spider or anything. We test with debug on one builder out of 47. So whenever possible we should try to create non-debug tests. There's an almost usable test in the bug description
            Roel Roel Van de Paar added a comment - midenok FYI, see https://jira.mariadb.org/browse/MDEV-29676?focusedCommentId=236586&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-236586 for a relevant example.

            The test case has been committed to bb-10.11-midenok and will be pushed with other 10.11 fixes.

            midenok Aleksey Midenkov added a comment - The test case has been committed to bb-10.11-midenok and will be pushed with other 10.11 fixes.
            Roel Roel Van de Paar added a comment - - edited

            Confirmed bb-10.11-midenok is free of the crash with the given testcase.

            Roel Roel Van de Paar added a comment - - edited Confirmed bb-10.11-midenok is free of the crash with the given testcase.

            bb-11.0-midenok-MDEV-25292 also does not crash.

            11.0.1 bb-11.0-midenok-MDEV-25292 b986107a777e3f900f235d969d569358c7a5edfe (Debug)

            11.0.1-dbg>INSTALL PLUGIN Spider SONAME 'ha_spider.so';
            Query OK, 0 rows affected, 1 warning (0.017 sec)
             
            11.0.1-dbg>CREATE USER Spider@localhost IDENTIFIED BY 'PWD1';
            Query OK, 0 rows affected (0.002 sec)
             
            11.0.1-dbg>CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET '../socket.sock',DATABASE 'test',user 'Spider',PASSWORD 'PWD1');
            Query OK, 0 rows affected (0.001 sec)
             
            11.0.1-dbg>CREATE TABLE t (c INT);
            Query OK, 0 rows affected (0.013 sec)
             
            11.0.1-dbg>CREATE TABLE t1 (c1 TEXT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"';
            Query OK, 0 rows affected (0.269 sec)
             
            11.0.1-dbg>CREATE OR REPLACE TABLE t2 AS SELECT FORMAT (c1,0) AS c1 FROM t1;  # 'OR REPLACE' is required
            ERROR 1054 (42S22): Unknown column 't0.c1' in 'field list'
            

            The incorrect t0 mention is discussed in MDEV-29663, and is unlikely to be related to this bug.

            It would seem that this bug has been fixed.

            Roel Roel Van de Paar added a comment - bb-11.0-midenok- MDEV-25292 also does not crash. 11.0.1 bb-11.0-midenok-MDEV-25292 b986107a777e3f900f235d969d569358c7a5edfe (Debug) 11.0.1-dbg>INSTALL PLUGIN Spider SONAME 'ha_spider.so'; Query OK, 0 rows affected, 1 warning (0.017 sec)   11.0.1-dbg>CREATE USER Spider@localhost IDENTIFIED BY 'PWD1'; Query OK, 0 rows affected (0.002 sec)   11.0.1-dbg>CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET '../socket.sock',DATABASE 'test',user 'Spider',PASSWORD 'PWD1'); Query OK, 0 rows affected (0.001 sec)   11.0.1-dbg>CREATE TABLE t (c INT); Query OK, 0 rows affected (0.013 sec)   11.0.1-dbg>CREATE TABLE t1 (c1 TEXT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"'; Query OK, 0 rows affected (0.269 sec)   11.0.1-dbg>CREATE OR REPLACE TABLE t2 AS SELECT FORMAT (c1,0) AS c1 FROM t1; # 'OR REPLACE' is required ERROR 1054 (42S22): Unknown column 't0.c1' in 'field list' The incorrect t0 mention is discussed in MDEV-29663 , and is unlikely to be related to this bug. It would seem that this bug has been fixed.

            People

              midenok Aleksey Midenkov
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              7 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.