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

flaw in external xa-commit with multiple xa-capable engines lead to assert

    XMLWordPrintable

Details

    • Q2/2025 Development

    Description

      --source include/have_binlog_format_statement.inc
      --source include/have_innodb.inc
      CREATE TABLE t (c INT) ENGINE=InnoDB;
      INSTALL PLUGIN Spider SONAME 'ha_spider.so';
      SET pseudo_slave_mode=1;
      XA START 'a';
      INSERT INTO t VALUES (1),(2),(3);
      XA END 'a';
      XA PREPARE 'a';
      XA COMMIT 'a';
      

      Leads to:

      bb-12.1-MDEV-32830_xa CS 12.0.1 dd6f8d29c276ec86b32a1833e9fd1f20751d16f8 (Debug) Build 12/05/2025

      mariadbd: /test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.cc:2084: int ha_commit_trans(THD *, bool): Assertion `!((&(&LOCK_commit_ordered)->m_mutex)->count > 0 && pthread_equal(pthread_self(), (&(&LOCK_commit_ordered)->m_mutex)->thread))' failed.
      

      bb-12.1-MDEV-32830_xa CS 12.0.1 dd6f8d29c276ec86b32a1833e9fd1f20751d16f8 (Debug) Build 12/05/2025

      Core was generated by `/test/MDEV-32830_MD120525-mariadb-12.0.1-linux-x86_64-dbg/bin/mariadbd --defaul'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
       
      [Current thread is 1 (LWP 2726344)]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)at ./nptl/pthread_kill.c:89
      #3  0x000070d29904526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x000070d2990288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000070d29902881b in __assert_fail_base (fmt=0x70d2991d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55a91fd37420 "!((&(&LOCK_commit_ordered)->m_mutex)->count > 0 && pthread_equal(pthread_self(), (&(&LOCK_commit_ordered)->m_mutex)->thread))", file=file@entry=0x55a91fd376b0 "/test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.cc", line=line@entry=2084, function=function@entry=0x55a91fd6ff3b "int ha_commit_trans(THD *, bool)")at ./assert/assert.c:94
      #6  0x000070d29903b507 in __assert_fail (assertion=0x55a91fd37420 "!((&(&LOCK_commit_ordered)->m_mutex)->count > 0 && pthread_equal(pthread_self(), (&(&LOCK_commit_ordered)->m_mutex)->thread))", file=0x55a91fd376b0 "/test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.cc", line=2084, function=0x55a91fd6ff3b "int ha_commit_trans(THD *, bool)")at ./assert/assert.c:103
      #7  0x000055a92043c0c0 in ha_commit_trans (thd=0x70d190000d58, all=false)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.cc:2084
      #8  0x000055a9207980f0 in THD::commit_whole_transaction_and_close_tables (this=0x70d190000d58)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_class.cc:6660
      #9  0x000070d29130a364 in spider_sys_close_table (thd=0x70d190000d58, open_tables_backup=0x70d291f61f98)at /test/bb-12.1-MDEV-32830_xa_dbg/storage/spider/spd_sys_table.cc:475
      #10 0x000070d29131c849 in spider_internal_xa_commit_by_xid (thd=0x70d190000d58, trx=0x70d1900ff248, xid=0x70d1900c1728)at /test/bb-12.1-MDEV-32830_xa_dbg/storage/spider/spd_trx.cc:2523
      #11 0x000070d29131e0d1 in spider_xa_commit_by_xid (xid=0x70d1900c1728)at /test/bb-12.1-MDEV-32830_xa_dbg/storage/spider/spd_trx.cc:3097
      #12 0x000055a92043d6f5 in xacommit_handlerton (hton=0x55a923ec2b58, arg=0x70d291f64f30) at /test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.cc:2478
      #13 0x000055a920438d0a in tp_foreach (thd=0x0, func=0x55a92043d6b0 <xacommit_handlerton(THD*, transaction_participant*, void*)>, arg=0x70d291f64f30) at /test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.cc:892
      #14 0x000055a92043d69e in commit_or_rollback_xa_engine (xid=0x70d1900c1728, is_commit=true) at /test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.cc:2499
      #15 0x000055a920432f35 in run_xa_complete_ordered (thd=0x70d190000d58)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/log.cc:10302
      #16 0x000055a9204211de in TC_LOG::run_commit_ordered (this=0x55a921a258b8 <mysql_bin_log>, thd=0x70d190000d58, all=true)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/log.cc:10345
      #17 0x000055a920423039 in MYSQL_BIN_LOG::trx_group_commit_with_engines (this=0x55a921a258b8 <mysql_bin_log>, leader=0x70d291f65588, tail=0x70d291f65588, commit_by_rotate=false)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/log.cc:9442
      #18 0x000055a92042100b in MYSQL_BIN_LOG::trx_group_commit_leader (this=0x55a921a258b8 <mysql_bin_log>, leader=0x70d291f65588)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/log.cc:9151
      #19 0x000055a920420a1b in MYSQL_BIN_LOG::write_transaction_with_group_commit (this=0x55a921a258b8 <mysql_bin_log>, entry=0x70d291f65588)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/log.cc:8985
      #20 0x000055a92043288e in MYSQL_BIN_LOG::write_transaction_to_binlog_events (this=0x55a921a258b8 <mysql_bin_log>, entry=0x70d291f65588)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/log.cc:8936
      #21 0x000055a92041f6c2 in MYSQL_BIN_LOG::write_transaction_to_binlog (this=0x55a921a258b8 <mysql_bin_log>, thd=0x70d190000d58, cache_mngr=0x70d190060c58, end_ev=0x70d291f65720, all=true, using_stmt_cache=false, using_trx_cache=true, is_ro_1pc=false)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/log.cc:8563
      #22 0x000055a92042ca50 in binlog_flush_cache (thd=0x70d190000d58, cache_mngr=0x70d190060c58, end_ev=0x70d291f65720, all=true, using_stmt=false, using_trx=true, is_ro_1pc=false)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/log.cc:1933
      #23 0x000055a92040daa2 in binlog_commit_flush_trx_cache (thd=0x70d190000d58, all=true, cache_mngr=0x70d190060c58, ro_1pc=false)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/log.cc:2072
      #24 0x000055a92040d235 in binlog_commit (thd=0x70d190000d58, all=true, ro_1pc=false) at /test/bb-12.1-MDEV-32830_xa_dbg/sql/log.cc:2420
      #25 0x000055a92042feaa in binlog_complete_by_xid (xid=0x70d1900c1728, is_commit=true) at /test/bb-12.1-MDEV-32830_xa_dbg/sql/log.cc:2250
      #26 0x000055a92040cc9e in binlog_commit_by_xid (xid=0x70d1900c1728)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/log.cc:2266
      #27 0x000055a92043d77b in ha_commit_or_rollback_by_xid (xid=0x70d1900c1728, is_commit=true, thd=0x70d190000d58)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.cc:2524
      #28 0x000055a920c62a94 in xa_complete (thd=0x70d190000d58, do_commit=true)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/xa.cc:782
      #29 0x000055a920c6225f in trans_xa_commit (thd=0x70d190000d58)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/xa.cc:825
      #30 0x000055a9208df290 in mysql_execute_command (thd=0x70d190000d58, is_called_from_prepared_stmt=false)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_parse.cc:5728
      #31 0x000055a9208cee34 in mysql_parse (thd=0x70d190000d58, rawbuf=0x70d190016c00 "XA COMMIT 'a'", length=13, parser_state=0x70d291f67a10)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_parse.cc:7891
      #32 0x000055a9208cc208 in dispatch_command (command=COM_QUERY, thd=0x70d190000d58, packet=0x70d1901c9489 "XA COMMIT 'a'", packet_length=13, blocking=true)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_parse.cc:1877
      #33 0x000055a9208cf9e3 in do_command (thd=0x70d190000d58, blocking=true)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_parse.cc:1416
      #34 0x000055a920aec9e9 in do_handle_one_connection (connect=0x55a923f7f7b8, put_in_cache=true)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_connect.cc:1414
      #35 0x000055a920aec78e in handle_one_connection (arg=0x55a923f6bf08)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_connect.cc:1326
      #36 0x000070d29909ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #37 0x000070d299129c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Attachments

        Issue Links

          Activity

            People

              Elkin Andrei Elkin
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.