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

Assertion `cache_mngr->trx_cache.empty() && cache_mngr->stmt_cache.empty()' failed in binlog_close_connection

Details

    • Bug
    • Status: Stalled (View Workflow)
    • Major
    • Resolution: Unresolved
    • 5.5(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL)
    • 10.4(EOL)
    • Replication

    Description

      --source include/have_innodb.inc
      --source include/have_binlog_format_row.inc
       
      CREATE TABLE t1 (a INT) ENGINE=InnoDB;
      CREATE TABLE t2 (b INT) ENGINE=InnoDB;
      CREATE TABLE t3 (c INT) ENGINE=InnoDB;
      CREATE TRIGGER tr1 BEFORE INSERT ON t3 FOR EACH ROW INSERT INTO t2 VALUES (NULL) ; 
      CREATE TRIGGER tr2 BEFORE UPDATE ON t2 FOR EACH ROW SET @a = 1; 
       
      LOCK TABLE t3 WRITE;
      SET AUTOCOMMIT = OFF;
      INSERT INTO t2 VALUES (1);
      SAVEPOINT A;
      UNLOCK TABLES;
      INSERT INTO t1 VALUES (2);
       
      # Cleanup
      DROP TABLE t1, t2, t3;
      

      5.5 e3d3bbf5

      mysqld: /data/src/5.5/sql/log.cc:1604: int binlog_close_connection(handlerton*, THD*): Assertion `cache_mngr->trx_cache.empty() && cache_mngr->stmt_cache.empty()' failed.
      191212 16:13:10 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fbf87806f12 in __GI___assert_fail (assertion=0x558b8eb3fb68 "cache_mngr->trx_cache.empty() && cache_mngr->stmt_cache.empty()", file=0x558b8eb3f7c0 "/data/src/5.5/sql/log.cc", line=1604, function=0x558b8eb42ba0 <binlog_close_connection(handlerton*, THD*)::__PRETTY_FUNCTION__> "int binlog_close_connection(handlerton*, THD*)") at assert.c:101
      #8  0x0000558b8e5f69ee in binlog_close_connection (hton=0x7fbf86fb13e0, thd=0x7fbf81f93060) at /data/src/5.5/sql/log.cc:1604
      #9  0x0000558b8e5362f4 in closecon_handlerton (thd=0x7fbf81f93060, plugin=0x7fbf78c1d930, unused=0x0) at /data/src/5.5/sql/handler.cc:678
      #10 0x0000558b8e397450 in plugin_foreach_with_mask (thd=0x7fbf81f93060, func=0x558b8e53627a <closecon_handlerton(THD*, plugin_ref, void*)>, type=1, state_mask=8, arg=0x0) at /data/src/5.5/sql/sql_plugin.cc:2359
      #11 0x0000558b8e536342 in ha_close_connection (thd=0x7fbf81f93060) at /data/src/5.5/sql/handler.cc:691
      #12 0x0000558b8e347031 in THD::~THD (this=0x7fbf81f93060, __in_chrg=<optimized out>) at /data/src/5.5/sql/sql_class.cc:1473
      #13 0x0000558b8e3472ec in THD::~THD (this=0x7fbf81f93060, __in_chrg=<optimized out>) at /data/src/5.5/sql/sql_class.cc:1503
      #14 0x0000558b8e2d4a45 in unlink_thd (thd=0x7fbf81f93060) at /data/src/5.5/sql/mysqld.cc:2433
      #15 0x0000558b8e2d4d63 in one_thread_per_connection_end (thd=0x7fbf81f93060, put_in_cache=true) at /data/src/5.5/sql/mysqld.cc:2538
      #16 0x0000558b8e48440c in do_handle_one_connection (thd_arg=0x7fbf81f93060) at /data/src/5.5/sql/sql_connect.cc:1279
      #17 0x0000558b8e4840e8 in handle_one_connection (arg=0x7fbf81f93060) at /data/src/5.5/sql/sql_connect.cc:1184
      #18 0x0000558b8e808d64 in pfs_spawn_thread (arg=0x7fbf81fb77a0) at /data/src/5.5/storage/perfschema/pfs.cc:1015
      #19 0x00007fbf88ead4a4 in start_thread (arg=0x7fbf89272700) at pthread_create.c:456
      #20 0x00007fbf878c3d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible on 5.5-10.5 debug builds.
      Not reproducible on MySQL 5.6, didn't try other MySQL versions.
      No obvious failure on non-debug builds, apart from WSREP warnings on 10.x (MDEV-21308):

      2019-12-12 16:14:38 10 [Warning] WSREP: binlog trx cache not empty (34 bytes) @ connection close 10
      2019-12-12 16:14:38 10 [Warning] WSREP: binlog stmt cache not empty (0 bytes) @ connection close 10
      

      But they cannot be causing the problem, since the assertion also fails on 5.5 vanilla tree which doesn't have WSREP.

      Attachments

        Issue Links

          Activity

            Also see MDEV-22420 for a very similar issue even though all these differ; assert message, stack, testcase, affected versions.

            Roel Roel Van de Paar added a comment - Also see MDEV-22420 for a very similar issue even though all these differ; assert message, stack, testcase, affected versions.
            Elkin Andrei Elkin added a comment - - edited

            MDEV-14472 may relate.

            Elkin Andrei Elkin added a comment - - edited MDEV-14472 may relate.
            Elkin Andrei Elkin added a comment -

            First MDEV-14472 a candidate for being this issue's parent needs fixing completion.
            It was analyzed to point to the root of that issue of the before trigger's error gets lost, execution continues only to the reported trouble.

            Elkin Andrei Elkin added a comment - First MDEV-14472 a candidate for being this issue's parent needs fixing completion. It was analyzed to point to the root of that issue of the before trigger's error gets lost, execution continues only to the reported trouble.
            Elkin Andrei Elkin added a comment -

            A dependency on MDEV-14472 is set to force the latter's fixing first and see.

            Elkin Andrei Elkin added a comment - A dependency on MDEV-14472 is set to force the latter's fixing first and see.

            People

              Elkin Andrei Elkin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.