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

Assertion `trx->in_depth > 0' failed in TrxInInnoDB::exit

    XMLWordPrintable

Details

    Description

      Note: stored procedure is not important for the scenario, it's just there to allow concurrency in MTR. Prepared statements appear to be important.

      --source include/have_innodb.inc
       
      CREATE TABLE IF NOT EXISTS t1 ( 
        a BIGINT(20) NOT NULL,
        b VARCHAR(200) NOT NULL,
        c DATE, d VARCHAR(30),
        e BIGINT(10),
        f TIMESTAMP(6),
        g VARCHAR(30),
        h CHAR(1) NOT NULL DEFAULT 'N',
        i VARCHAR(50),
        j VARCHAR(50),
        k VARCHAR(255),
        l VARCHAR(50),
        m ENUM('N','Y') NOT NULL,
        n VARCHAR(100),
        o INT(3) NOT NULL,
        p INT(10),
        q VARCHAR(50),
        r BIGINT(11) NOT NULL,
        PRIMARY KEY (a,o),
        UNIQUE KEY idx1(b,o),
        UNIQUE KEY idx2(a,p,o),
        UNIQUE KEY idx3(q),
        KEY idx4(e,o),
        KEY idx5(p,o),
        KEY idx6(o,c),
        KEY idx7(r,o),
        FOREIGN KEY (e,o) REFERENCES t1 (a,o)
      ) ENGINE=InnoDB;
       
      --delimiter $$
      CREATE PROCEDURE pr(val INT)
      BEGIN
        DECLARE n INT DEFAULT 100000;
        WHILE n > 0 DO
          PREPARE stmt FROM CONCAT("UPDATE t1 SET o = o + 1 WHERE o = ",val);
          EXECUTE stmt;
          SET n = n - 1;
        END WHILE;
      END $$
      --delimiter ;
        
      --connect (con1,localhost,root,,test)
      --send 
        CALL pr(1);
       
      --connect (con2,localhost,root,,test)
      --send 
        CALL pr(2);
       
      --connect (con3,localhost,root,,test)
      --send 
        CALL pr(3);
       
      --connect (con4,localhost,root,,test)
        CALL pr(4);
       
      # Cleanup
       
      --disconnect con4
       
      --connection con3
      --reap
      --disconnect con3
       
      --connection con2
      --reap
      --disconnect con2
       
      --connection con1
      --reap
      --disconnect con1
       
      --connection default
      DROP PROCEDURE pr;
      DROP TABLE t1;
      

      10.3 0f26f71b496f4

      mysqld: /data/src/10.3/storage/innobase/include/trx0trx.h:1522: static void TrxInInnoDB::exit(trx_t*): Assertion `trx->in_depth > 0' failed.
      180328 23:59:27 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f61cb1a3ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x0000563c949acc75 in TrxInInnoDB::exit (trx=0x7f61c4fdfde0) at /data/src/10.3/storage/innobase/include/trx0trx.h:1522
      #9  0x0000563c949ac9cb in TrxInInnoDB::end_stmt (trx=0x7f61c4fdfde0) at /data/src/10.3/storage/innobase/include/trx0trx.h:1445
      #10 0x0000563c949a1175 in ha_innobase::external_lock (this=0x7f617803af28, thd=0x7f616c000b00, lock_type=2) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:16015
      #11 0x0000563c9467f905 in handler::ha_external_lock (this=0x7f617803af28, thd=0x7f616c000b00, lock_type=2) at /data/src/10.3/sql/handler.cc:6116
      #12 0x0000563c9479966a in unlock_external (thd=0x7f616c000b00, table=0x7f616c02c960, count=1) at /data/src/10.3/sql/lock.cc:729
      #13 0x0000563c94798a7d in mysql_unlock_tables (thd=0x7f616c000b00, sql_lock=0x7f616c02c938, free_lock=false) at /data/src/10.3/sql/lock.cc:434
      #14 0x0000563c947989d5 in mysql_unlock_tables (thd=0x7f616c000b00, sql_lock=0x7f616c02c938) at /data/src/10.3/sql/lock.cc:420
      #15 0x0000563c942fc908 in close_thread_tables (thd=0x7f616c000b00) at /data/src/10.3/sql/sql_base.cc:843
      #16 0x0000563c94392d1a in mysql_execute_command (thd=0x7f616c000b00) at /data/src/10.3/sql/sql_parse.cc:6358
      #17 0x0000563c943b5153 in Prepared_statement::execute (this=0x7f616c02e770, expanded_query=0x7f61c44524c0, open_cursor=false) at /data/src/10.3/sql/sql_prepare.cc:4739
      #18 0x0000563c943b356f in Prepared_statement::execute_loop (this=0x7f616c02e770, expanded_query=0x7f61c44524c0, open_cursor=false, packet=0x0, packet_end=0x0) at /data/src/10.3/sql/sql_prepare.cc:4170
      #19 0x0000563c943b118d in mysql_sql_stmt_execute (thd=0x7f616c000b00) at /data/src/10.3/sql/sql_prepare.cc:3278
      #20 0x0000563c9438a218 in mysql_execute_command (thd=0x7f616c000b00) at /data/src/10.3/sql/sql_parse.cc:3779
      #21 0x0000563c942bbea2 in sp_instr_stmt::exec_core (this=0x7f616c01ccc0, thd=0x7f616c000b00, nextp=0x7f61c445370c) at /data/src/10.3/sql/sp_head.cc:3595
      #22 0x0000563c942bb2b2 in sp_lex_keeper::reset_lex_and_exec_core (this=0x7f616c01cd10, thd=0x7f616c000b00, nextp=0x7f61c445370c, open_tables=false, instr=0x7f616c01ccc0) at /data/src/10.3/sql/sp_head.cc:3311
      #23 0x0000563c942bba5b in sp_instr_stmt::execute (this=0x7f616c01ccc0, thd=0x7f616c000b00, nextp=0x7f61c445370c) at /data/src/10.3/sql/sp_head.cc:3498
      #24 0x0000563c942b581f in sp_head::execute (this=0x7f616c01af58, thd=0x7f616c000b00, merge_da_on_success=true) at /data/src/10.3/sql/sp_head.cc:1349
      #25 0x0000563c942b81c4 in sp_head::execute_procedure (this=0x7f616c01af58, thd=0x7f616c000b00, args=0x7f616c0056d0) at /data/src/10.3/sql/sp_head.cc:2287
      #26 0x0000563c94387b9a in do_execute_sp (thd=0x7f616c000b00, sp=0x7f616c01af58) at /data/src/10.3/sql/sql_parse.cc:2936
      #27 0x0000563c9438871b in Sql_cmd_call::execute (this=0x7f616c013a50, thd=0x7f616c000b00) at /data/src/10.3/sql/sql_parse.cc:3178
      #28 0x0000563c943929f1 in mysql_execute_command (thd=0x7f616c000b00) at /data/src/10.3/sql/sql_parse.cc:6280
      #29 0x0000563c943975b2 in mysql_parse (thd=0x7f616c000b00, rawbuf=0x7f616c013988 "CALL pr(2)", length=10, parser_state=0x7f61c44555d0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8009
      #30 0x0000563c94384c66 in dispatch_command (command=COM_QUERY, thd=0x7f616c000b00, packet=0x7f616c00b251 "CALL pr(2)", packet_length=10, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1838
      #31 0x0000563c943836a5 in do_command (thd=0x7f616c000b00) at /data/src/10.3/sql/sql_parse.cc:1383
      #32 0x0000563c944e7b0d in do_handle_one_connection (connect=0x563c97751b70) at /data/src/10.3/sql/sql_connect.cc:1402
      #33 0x0000563c944e789a in handle_one_connection (arg=0x563c97751b70) at /data/src/10.3/sql/sql_connect.cc:1308
      #34 0x0000563c9496ed7d in pfs_spawn_thread (arg=0x563c977f37a0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #35 0x00007f61cce7a494 in start_thread (arg=0x7f61c4456700) at pthread_create.c:333
      #36 0x00007f61cb26093f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Also reproducible on bb-10.2-compatibility build 18904.
      Could not reproduce on 10.2 with this test case, even though my notes say that a similar assertion failure was observed on 10.2 in January.

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              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.