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

Assertion `trx_state == TRX_STATE_PREPARED || trx_state == TRX_STATE_PREPARED_RECOVERED || trx_state == TRX_STATE_ACTIVE' failed in void trx_t::commit_state()

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      --source include/have_innodb.inc
      --let $restart_parameters=--innodb-rollback-on-timeout=1
      --source include/restart_mysqld.inc
       
      SET SESSION pseudo_slave_mode=ON;
      CREATE TABLE t (a INT);
      XA START 'a';
      INSERT INTO t VALUES (1);
      XA END 'a';
      XA PREPARE 'a';
      ALTER TABLE t IMPORT TABLESPACE;
      

      Leads to:

      CS 10.6.21 155203c3521babed20636df15a1547d94f732469 (Debug)

      mariadbd: /test/10.6_dbg/storage/innobase/trx/trx0trx.cc:466: void trx_t::commit_state(): Assertion `trx_state == TRX_STATE_PREPARED || trx_state == TRX_STATE_PREPARED_RECOVERED || trx_state == TRX_STATE_ACTIVE' failed.
      

      CS 10.6.21 155203c3521babed20636df15a1547d94f732469 (Debug)

      Core was generated by `/test/MD131224-mariadb-10.6.21-linux-x86_64-dbg/bin/mariadbd --no-defaults --ma'.
      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 0x14c55c0da700 (LWP 3076972))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x000014c567eee859 in __GI_abort () at abort.c:79
      #2  0x000014c567eee729 in __assert_fail_base (fmt=0x14c568084588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5609dd292210 "trx_state == TRX_STATE_PREPARED || trx_state == TRX_STATE_PREPARED_RECOVERED || trx_state == TRX_STATE_ACTIVE", file=0x5609dd291720 "/test/10.6_dbg/storage/innobase/trx/trx0trx.cc", line=466, function=<optimized out>) at assert.c:92
      #3  0x000014c567efffd6 in __GI___assert_fail (assertion=assertion@entry=0x5609dd292210 "trx_state == TRX_STATE_PREPARED || trx_state == TRX_STATE_PREPARED_RECOVERED || trx_state == TRX_STATE_ACTIVE", file=file@entry=0x5609dd291720 "/test/10.6_dbg/storage/innobase/trx/trx0trx.cc", line=line@entry=466, function=function@entry=0x5609dd29145c "void trx_t::commit_state()") at assert.c:101
      #4  0x00005609dcc3a532 in trx_t::commit_state (this=0x14c55f71f600) at /test/10.6_dbg/storage/innobase/trx/trx0trx.cc:466
      #5  trx_t::commit_in_memory (mtr=0x0, this=0x14c55f71f600) at /test/10.6_dbg/storage/innobase/trx/trx0trx.cc:1417
      #6  trx_t::commit_low (this=this@entry=0x14c55f71f600, mtr=0x0) at /test/10.6_dbg/storage/innobase/trx/trx0trx.cc:1585
      #7  0x00005609dcc3b0ab in trx_t::commit_persist (this=this@entry=0x14c55f71f600) at /test/10.6_dbg/storage/innobase/trx/trx0trx.cc:1599
      #8  0x00005609dcc3b115 in trx_t::commit (this=0x14c55f71f600) at /test/10.6_dbg/storage/innobase/trx/trx0trx.cc:1608
      #9  0x00005609dca0ddf6 in ha_innobase::discard_or_import_tablespace (this=0x14c51c030850, discard=<optimized out>) at /test/10.6_dbg/storage/innobase/handler/ha_innodb.cc:13449
      #10 0x00005609dc6d5ad7 in handler::ha_discard_or_import_tablespace (this=0x14c51c030850, discard=discard@entry=0 '\000') at /test/10.6_dbg/sql/handler.cc:5355
      #11 0x00005609dc4c4c77 in mysql_discard_or_import_tablespace (thd=thd@entry=0x14c51c000d48, table_list=table_list@entry=0x14c51c013278, discard=<optimized out>) at /test/10.6_dbg/sql/sql_table.cc:5651
      #12 0x00005609dc55a21e in Sql_cmd_discard_import_tablespace::execute (this=0x14c51c013980, thd=0x14c51c000d48) at /test/10.6_dbg/sql/sql_alter.cc:712
      #13 0x00005609dc40a499 in mysql_execute_command (thd=thd@entry=0x14c51c000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.6_dbg/sql/sql_parse.cc:6157
      #14 0x00005609dc3f1df2 in mysql_parse (thd=thd@entry=0x14c51c000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14c55c0d9320) at /test/10.6_dbg/sql/sql_parse.cc:8199
      #15 0x00005609dc40029f in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14c51c000d48, packet=packet@entry=0x14c51c00ade9 "ALTER TABLE t IMPORT TABLESPACE", packet_length=packet_length@entry=31, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1419
      #16 0x00005609dc4029ab in do_command (thd=thd@entry=0x14c51c000d48, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1422
      #17 0x00005609dc553c0b in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5609df8d7318, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1386
      #18 0x00005609dc5540d9 in handle_one_connection (arg=0x5609df8d7318) at /test/10.6_dbg/sql/sql_connect.cc:1298
      #19 0x000014c56841a609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #20 0x000014c567feb133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      CS 11.4.5 b66d421d601443d9f5e2c49a32a81eb88fa1cd9c (Debug)

      mariadbd: /test/11.4_dbg/storage/innobase/trx/trx0trx.cc:470: void trx_t::commit_state(): Assertion `state == TRX_STATE_PREPARED || state == TRX_STATE_PREPARED_RECOVERED || state == TRX_STATE_ACTIVE' failed.
      

      CS 11.4.5 b66d421d601443d9f5e2c49a32a81eb88fa1cd9c (Debug)

      Core was generated by `/test/MD161224-mariadb-11.4.5-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
      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 0x152cb80f1700 (LWP 3085235))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x0000152cc17e3859 in __GI_abort () at abort.c:79
      #2  0x0000152cc17e3729 in __assert_fail_base (fmt=0x152cc1979588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5635c6da0eb8 "state == TRX_STATE_PREPARED || state == TRX_STATE_PREPARED_RECOVERED || state == TRX_STATE_ACTIVE", file=0x5635c6da0398 "/test/11.4_dbg/storage/innobase/trx/trx0trx.cc", line=470, function=<optimized out>) at assert.c:92
      #3  0x0000152cc17f4fd6 in __GI___assert_fail (assertion=assertion@entry=0x5635c6da0eb8 "state == TRX_STATE_PREPARED || state == TRX_STATE_PREPARED_RECOVERED || state == TRX_STATE_ACTIVE", file=file@entry=0x5635c6da0398 "/test/11.4_dbg/storage/innobase/trx/trx0trx.cc", line=line@entry=470, function=function@entry=0x5635c6da00d5 "void trx_t::commit_state()") at assert.c:101
      #4  0x00005635c6713455 in trx_t::commit_state (this=0x152cb85b1680) at /test/11.4_dbg/storage/innobase/trx/trx0trx.cc:470
      #5  trx_t::commit_in_memory (mtr=0x0, this=0x152cb85b1680) at /test/11.4_dbg/storage/innobase/trx/trx0trx.cc:1426
      #6  trx_t::commit_low (this=this@entry=0x152cb85b1680, mtr=0x0) at /test/11.4_dbg/storage/innobase/trx/trx0trx.cc:1599
      #7  0x00005635c6713e19 in trx_t::commit_persist (this=this@entry=0x152cb85b1680) at /test/11.4_dbg/storage/innobase/trx/trx0trx.cc:1613
      #8  0x00005635c6713e9b in trx_t::commit (this=0x152cb85b1680) at /test/11.4_dbg/storage/innobase/trx/trx0trx.cc:1622
      #9  0x00005635c64eedc4 in ha_innobase::discard_or_import_tablespace (this=0x152c70031a90, discard=<optimized out>) at /test/11.4_dbg/storage/innobase/handler/ha_innodb.cc:13364
      #10 0x00005635c61e0035 in handler::ha_discard_or_import_tablespace (this=0x152c70031a90, discard=discard@entry=0 '\000') at /test/11.4_dbg/sql/handler.cc:5542
      #11 0x00005635c5f9aed8 in mysql_discard_or_import_tablespace (thd=thd@entry=0x152c70000d48, table_list=table_list@entry=0x152c7001a748, discard=<optimized out>) at /test/11.4_dbg/sql/sql_table.cc:5848
      #12 0x00005635c6036518 in Sql_cmd_discard_import_tablespace::execute (this=0x152c7001ae58, thd=0x152c70000d48) at /test/11.4_dbg/sql/sql_alter.cc:738
      #13 0x00005635c5ec3183 in mysql_execute_command (thd=thd@entry=0x152c70000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/11.4_dbg/sql/sql_parse.cc:5869
      #14 0x00005635c5eaaa9b in mysql_parse (thd=thd@entry=0x152c70000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x152cb80f0310) at /test/11.4_dbg/sql/sql_parse.cc:7898
      #15 0x00005635c5eb8d2a in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x152c70000d48, packet=packet@entry=0x152c7000afe9 "ALTER TABLE t IMPORT TABLESPACE", packet_length=packet_length@entry=31, blocking=blocking@entry=true) at /test/11.4_dbg/sql/sql_class.h:1564
      #16 0x00005635c5ebb423 in do_command (thd=thd@entry=0x152c70000d48, blocking=blocking@entry=true) at /test/11.4_dbg/sql/sql_parse.cc:1419
      #17 0x00005635c602fc5d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5635c9fd0c08, put_in_cache=put_in_cache@entry=true) at /test/11.4_dbg/sql/sql_connect.cc:1408
      #18 0x00005635c603012b in handle_one_connection (arg=0x5635c9fd0c08) at /test/11.4_dbg/sql/sql_connect.cc:1320
      #19 0x0000152cc1d0f609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #20 0x0000152cc18e0133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.6.21 (dbg), 10.11.11 (dbg), 11.4.5 (dbg), 11.7.1 (dbg), 11.8.0 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.5.28 (dbg), 10.5.28 (opt), 10.6.21 (opt), 10.11.11 (opt), 11.4.5 (opt), 11.7.1 (opt), 11.8.0 (opt)

      Updated bug matrix 11/11/25:

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.6   dbg  101125  759e3523e3d832b174cf0a612704da38b2557b40  trx_state == TRX_STATE_PREPARED || trx_state == TRX_STATE_PREPARED_RECOVERED || trx_state == TRX_STATE_ACTIVE|SIGABRT|trx_t::commit_state|trx_t::commit_in_memory|trx_t::commit_low|trx_t::commit_persist
      CS  10.6   opt  101125  759e3523e3d832b174cf0a612704da38b2557b40  No bug found                  
      CS  10.11  dbg  101125  536cd151f0370216d9ba4c15f40c7037060972a5  trx_state == TRX_STATE_PREPARED || trx_state == TRX_STATE_PREPARED_RECOVERED || trx_state == TRX_STATE_ACTIVE|SIGABRT|trx_t::commit_state|trx_t::commit_in_memory|trx_t::commit_low|trx_t::commit_persist
      CS  10.11  opt  101125  536cd151f0370216d9ba4c15f40c7037060972a5  No bug found                  
      CS  11.4   dbg  101125  a1bb5c94fda453baa99e57e3927eaa7cd3c8bafe  trx_state == TRX_STATE_PREPARED || trx_state == TRX_STATE_PREPARED_RECOVERED || trx_state == TRX_STATE_ACTIVE|SIGABRT|trx_t::commit_state|trx_t::commit_in_memory|trx_t::commit_persist|trx_t::commit
      CS  11.4   opt  101125  a1bb5c94fda453baa99e57e3927eaa7cd3c8bafe  No bug found                  
      CS  11.8   dbg  101125  e0428264d0095472c015eb58c46be68ca1a320ee  trx_state == TRX_STATE_PREPARED || trx_state == TRX_STATE_PREPARED_RECOVERED || trx_state == TRX_STATE_ACTIVE|SIGABRT|trx_t::commit_state|trx_t::commit_in_memory|trx_t::commit_persist|trx_t::commit
      CS  11.8   opt  101125  e0428264d0095472c015eb58c46be68ca1a320ee  No bug found                  
      CS  12.1   dbg  101125  ba00960fdaee67a4efff6866e31f446bf486a1c2  trx_state == TRX_STATE_PREPARED || trx_state == TRX_STATE_PREPARED_RECOVERED || trx_state == TRX_STATE_ACTIVE|SIGABRT|trx_t::commit_state|trx_t::commit_in_memory|trx_t::commit_persist|trx_t::commit
      CS  12.1   opt  101125  ba00960fdaee67a4efff6866e31f446bf486a1c2  No bug found                  
      CS  12.2   dbg  101125  fd15fd2765b53d0c070dd01d86fb231024b8f284  trx_state == TRX_STATE_PREPARED || trx_state == TRX_STATE_PREPARED_RECOVERED || trx_state == TRX_STATE_ACTIVE|SIGABRT|trx_t::commit_state|trx_t::commit_in_memory|trx_t::commit_persist|trx_t::commit
      CS  12.2   opt  101125  fd15fd2765b53d0c070dd01d86fb231024b8f284  No bug found                  
      ES  10.6   dbg  101125  f0d4d34fb0314b03fddb71fb9dbde372744a8c13  trx_state == TRX_STATE_PREPARED || trx_state == TRX_STATE_PREPARED_RECOVERED || trx_state == TRX_STATE_ACTIVE|SIGABRT|trx_t::commit_state|trx_t::commit_in_memory|trx_t::commit_low|trx_t::commit_persist
      ES  10.6   opt  101125  f0d4d34fb0314b03fddb71fb9dbde372744a8c13  No bug found                  
      ES  11.4   dbg  101125  b81ec4b57a5ddce88b8e2b2d16b64625ffdaa0e6  trx_state == TRX_STATE_PREPARED || trx_state == TRX_STATE_PREPARED_RECOVERED || trx_state == TRX_STATE_ACTIVE|SIGABRT|trx_t::commit_state|trx_t::commit_in_memory|trx_t::commit_low|trx_t::commit_persist
      ES  11.4   opt  101125  b81ec4b57a5ddce88b8e2b2d16b64625ffdaa0e6  No bug found                  
      ES  11.8   dbg  101125  db36e8fb3bcdae26dd0acdcb2b52f7f4eb014df6  trx_state == TRX_STATE_PREPARED || trx_state == TRX_STATE_PREPARED_RECOVERED || trx_state == TRX_STATE_ACTIVE|SIGABRT|trx_t::commit_state|trx_t::commit_in_memory|trx_t::commit_persist|trx_t::commit
      ES  11.8   opt  101125  db36e8fb3bcdae26dd0acdcb2b52f7f4eb014df6  No bug found                  
      MS  5.5    dbg  070123  bac287c315b1792e7ae33f91add6a60292f9bae8  No bug found                  
      MS  5.5    opt  070123  bac287c315b1792e7ae33f91add6a60292f9bae8  No bug found                  
      MS  5.6    dbg  070123  dab95781a1244104d6b87020ac2fc4d190ba2946  No bug found                  
      MS  5.6    opt  070123  dab95781a1244104d6b87020ac2fc4d190ba2946  No bug found                  
      MS  5.7    dbg  070525  f7680e98b6bbe3500399fbad465d08a6b75d7a5c  No bug found                  
      MS  5.7    opt  070525  f7680e98b6bbe3500399fbad465d08a6b75d7a5c  No bug found                  
      MS  8.0    dbg  060224  49ef33f7edadef3ae04665e73d1babd40179a4f1  No bug found, waiting thread           
      MS  8.0    opt  060224  49ef33f7edadef3ae04665e73d1babd40179a4f1  No bug found, waiting thread           
      MS  9.1    dbg  211024  61a3a1d8ef15512396b4c2af46e922a19bf2b174  No bug found, waiting thread
      MS  9.1    opt  211024  61a3a1d8ef15512396b4c2af46e922a19bf2b174  No bug found, waiting thread
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.