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

SIGSEGV in TC_LOG::run_prepare_ordered on ROLLBACK

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Done
    • N/A
    • N/A
    • XA
    • None
    • Q2/2025 Development

    Description

      CLI:

      # mysqld options required for replay:  --log_bin=binlog --binlog_format=ROW
      CREATE TABLE t (c INT);
      XA START 'a';
      SAVEPOINT s;
      INSERT INTO t VALUES (1);
      CREATE TEMPORARY TABLE t (c INT);
      SELECT * FROM mysql.proc;
      ROLLBACK WORK TO s;
      

      MTR:

      --source include/have_binlog_format_row.inc
      --source include/have_innodb.inc
      CREATE TABLE t (c INT) ENGINE=InnoDB;
      XA START 'a';
      SAVEPOINT s;
      INSERT INTO t VALUES (1);
      CREATE TEMPORARY TABLE t (c INT) ENGINE=InnoDB;
      SELECT * FROM mysql.proc;
      ROLLBACK WORK TO s;
      

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

      Core was generated by `/test/MDEV-32830_MD120525-mariadb-12.0.1-linux-x86_64-opt/bin/mariadbd --no-def'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  TC_LOG::run_prepare_ordered (this=0x577bec21b7a8 <mysql_bin_log>, thd=0x7e59fc000c68, all=<optimized out>)at /test/bb-12.1-MDEV-32830_xa_opt/sql/log.cc:10277
      10277	    if (!ht->prepare_ordered)
      [Current thread is 1 (LWP 94744)]
      (gdb) bt
      #0  TC_LOG::run_prepare_ordered (this=0x577bec21b7a8 <mysql_bin_log>, thd=0x7e59fc000c68, all=<optimized out>)at /test/bb-12.1-MDEV-32830_xa_opt/sql/log.cc:10277
      #1  MYSQL_BIN_LOG::queue_for_group_commit (this=this@entry=0x577bec21b7a8 <mysql_bin_log>, orig_entry=orig_entry@entry=0x7e5b50167998)at /test/bb-12.1-MDEV-32830_xa_opt/sql/log.cc:8794
      #2  0x0000577beb4e7ff6 in MYSQL_BIN_LOG::write_transaction_with_group_commit (this=0x577bec21c948 <LOCK_prepare_ordered>, this@entry=0x577bec21b7a8 <mysql_bin_log>, entry=0x10, entry@entry=0x7e5b50167998)at /test/bb-12.1-MDEV-32830_xa_opt/sql/log.cc:8949
      #3  0x0000577beb4e75b4 in MYSQL_BIN_LOG::write_transaction_to_binlog_events (this=0x577bec21b7a8 <mysql_bin_log>, entry=0x7e5b50167998)at /test/bb-12.1-MDEV-32830_xa_opt/sql/log.cc:8936
      #4  MYSQL_BIN_LOG::write_transaction_to_binlog (this=0x577bec21b7a8 <mysql_bin_log>, thd=thd@entry=0x7e59fc000c68, cache_mngr=cache_mngr@entry=0x7e59fc021768, end_ev=end_ev@entry=0x7e5b50167a90, all=true, using_stmt_cache=<optimized out>, using_trx_cache=<optimized out>, is_ro_1pc=<optimized out>)at /test/bb-12.1-MDEV-32830_xa_opt/sql/log.cc:8563
      #5  0x0000577beb4ef6a5 in binlog_flush_cache (thd=thd@entry=0x7e59fc000c68, cache_mngr=cache_mngr@entry=0x7e59fc021768, end_ev=end_ev@entry=0x7e5b50167a90, all=true, using_stmt=false, using_trx=true, is_ro_1pc=<optimized out>)at /test/bb-12.1-MDEV-32830_xa_opt/sql/log.cc:1933
      #6  0x0000577beb4ef301 in binlog_rollback_flush_trx_cache (thd=0x7e59fc000c68, all=true, cache_mngr=0x7e59fc021768)at /test/bb-12.1-MDEV-32830_xa_opt/sql/log.cc:2106
      #7  binlog_rollback (thd=0x7e59fc000c68, all=true)at /test/bb-12.1-MDEV-32830_xa_opt/sql/log.cc:2521
      #8  0x0000577beb4f5b84 in ha_rollback_to_savepoint (thd=thd@entry=0x7e59fc000c68, sv=sv@entry=0x7e59fc01f780)at /test/bb-12.1-MDEV-32830_xa_opt/sql/handler.cc:3123
      #9  0x0000577beb9153a6 in trans_rollback_to_savepoint (thd=thd@entry=0x7e59fc000c68, name={str = <optimized out>, length = 1})at /test/bb-12.1-MDEV-32830_xa_opt/sql/transaction.cc:728
      #10 0x0000577beb7b3035 in mysql_execute_command (thd=thd@entry=0x7e59fc000c68, is_called_from_prepared_stmt=false)at /test/bb-12.1-MDEV-32830_xa_opt/sql/sql_parse.cc:5565
      #11 0x0000577beb7ad671 in mysql_parse (thd=thd@entry=0x7e59fc000c68, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7e5b50168420)at /test/bb-12.1-MDEV-32830_xa_opt/sql/sql_parse.cc:7891
      #12 0x0000577beb7abb8f in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7e59fc000c68, packet=packet@entry=0x7e59fc008af9 "ROLLBACK WORK TO s", packet_length=packet_length@entry=18, blocking=true)at /test/bb-12.1-MDEV-32830_xa_opt/sql/sql_parse.cc:1877
      #13 0x0000577beb7ada81 in do_command (thd=thd@entry=0x7e59fc000c68, blocking=true) at /test/bb-12.1-MDEV-32830_xa_opt/sql/sql_parse.cc:1416
      #14 0x0000577beb902b8d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x577beeb952e8, put_in_cache=true)at /test/bb-12.1-MDEV-32830_xa_opt/sql/sql_connect.cc:1414
      #15 0x0000577beb90294f in handle_one_connection (arg=arg@entry=0x577beeb952e8)at /test/bb-12.1-MDEV-32830_xa_opt/sql/sql_connect.cc:1326
      #16 0x0000577bebabed39 in pfs_spawn_thread (arg=0x577beeb420e8)at /test/bb-12.1-MDEV-32830_xa_opt/storage/perfschema/pfs.cc:2198
      #17 0x00007e5b57a9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #18 0x00007e5b57b29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      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.h:2033: transaction_participant *Ha_trx_info::ht() const: Assertion `is_started()' 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 145210)]
      (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  0x000076d649a4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x000076d649a288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000076d649a2881b in __assert_fail_base (fmt=0x76d649bd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x576f152c000d "is_started()", file=file@entry=0x576f15305770 "/test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.h", line=line@entry=2033, function=function@entry=0x576f15312dd0 "transaction_participant *Ha_trx_info::ht() const") at ./assert/assert.c:94
      #6  0x000076d649a3b507 in __assert_fail (assertion=0x576f152c000d "is_started()", file=0x576f15305770 "/test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.h", line=2033, function=0x576f15312dd0 "transaction_participant *Ha_trx_info::ht() const")at ./assert/assert.c:103
      #7  0x0000576f159d46e7 in Ha_trx_info::ht (this=0x76d568003b40)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.h:2033
      #8  0x0000576f159c3312 in TC_LOG::run_prepare_ordered (this=0x576f16fc88b8 <mysql_bin_log>, thd=0x76d568000d58, all=true)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/log.cc:10276
      #9  0x0000576f159c2ddb in MYSQL_BIN_LOG::queue_for_group_commit (this=0x576f16fc88b8 <mysql_bin_log>, orig_entry=0x76d63ff65d68)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/log.cc:8794
      #10 0x0000576f159c3721 in MYSQL_BIN_LOG::write_transaction_with_group_commit (this=0x576f16fc88b8 <mysql_bin_log>, entry=0x76d63ff65d68)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/log.cc:8949
      #11 0x0000576f159d588e in MYSQL_BIN_LOG::write_transaction_to_binlog_events (this=0x576f16fc88b8 <mysql_bin_log>, entry=0x76d63ff65d68)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/log.cc:8936
      #12 0x0000576f159c26c2 in MYSQL_BIN_LOG::write_transaction_to_binlog (this=0x576f16fc88b8 <mysql_bin_log>, thd=0x76d568000d58, cache_mngr=0x76d5680a1608, end_ev=0x76d63ff65ec0, 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
      #13 0x0000576f159cfa50 in binlog_flush_cache (thd=0x76d568000d58, cache_mngr=0x76d5680a1608, end_ev=0x76d63ff65ec0, 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
      #14 0x0000576f159cf7f3 in binlog_rollback_flush_trx_cache (thd=0x76d568000d58, all=true, cache_mngr=0x76d5680a1608)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/log.cc:2106
      #15 0x0000576f159cf1af in binlog_rollback (thd=0x76d568000d58, all=true)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/log.cc:2521
      #16 0x0000576f159e1803 in ha_rollback_to_savepoint (thd=0x76d568000d58, sv=0x76d56801ec00) at /test/bb-12.1-MDEV-32830_xa_dbg/sql/handler.cc:3123
      #17 0x0000576f160af23e in trans_rollback_to_savepoint (thd=0x76d568000d58, name={str = 0x76d568016c88 "s", length = 1})at /test/bb-12.1-MDEV-32830_xa_dbg/sql/transaction.cc:728
      #18 0x0000576f15e8178d in mysql_execute_command (thd=0x76d568000d58, is_called_from_prepared_stmt=false)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_parse.cc:5565
      #19 0x0000576f15e71e34 in mysql_parse (thd=0x76d568000d58, rawbuf=0x76d568016c00 "ROLLBACK WORK TO s", length=18, parser_state=0x76d63ff67a10)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_parse.cc:7891
      #20 0x0000576f15e6f208 in dispatch_command (command=COM_QUERY, thd=0x76d568000d58, packet=0x76d5681c9489 "ROLLBACK WORK TO s", packet_length=18, blocking=true)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_parse.cc:1877
      #21 0x0000576f15e729e3 in do_command (thd=0x76d568000d58, blocking=true)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_parse.cc:1416
      #22 0x0000576f1608f9e9 in do_handle_one_connection (connect=0x576f19c017b8, put_in_cache=true)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_connect.cc:1414
      #23 0x0000576f1608f78e in handle_one_connection (arg=0x576f19bedf08)at /test/bb-12.1-MDEV-32830_xa_dbg/sql/sql_connect.cc:1326
      #24 0x000076d649a9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #25 0x000076d649b29c3c 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:
              3 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.