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

Assertion `rpl_semi_sync_master_off_times > thd->expected_semi_sync_offs' failed in Repl_semi_sync_master::commit_trx on CREATE TABLE

    XMLWordPrintable

Details

    • Can result in hang or crash
    • Hide
      When rpl_semi_sync_master_enabled was set to 1 and rpl_semi_sync_master_wait_point was set to AFTER_SYNC, a failed binary log write (which results in a file write error) caused the server to unnecessarily attempt to wait for the failed transaction to sync. The server now correctly bypasses the semisync wait stage if the binary log write fails.
      Show
      When rpl_semi_sync_master_enabled was set to 1 and rpl_semi_sync_master_wait_point was set to AFTER_SYNC, a failed binary log write (which results in a file write error) caused the server to unnecessarily attempt to wait for the failed transaction to sync. The server now correctly bypasses the semisync wait stage if the binary log write fails.

    Description

      There may be some connection with MDEV-35397, though the testcases are very different. Another odd thing is that this testcase does not replay in MTR (resolved; see below), nor in various automated runs. The only way to make it reliably and consistently reproduce is manual replay at the command line.

      # mysqld options required for replay: --log-bin
      SET GLOBAL rpl_semi_sync_master_enabled=1;
      SET SESSION gtid_seq_no=1;
      SET GLOBAL rpl_semi_sync_master_wait_point=AFTER_SYNC;
      SET GLOBAL gtid_strict_mode=1;
      CREATE TABLE t (value INT);
      

      Leads to:

      ES 10.6.25-21 0fe345fff3a0463224ca714831303d40fb83648b (Debug, Clang 21.1.3-20250923) Build 23/01/2026

      mariadbd: /test/10.6-es_dbg/sql/semisync_master.cc:967: int Repl_semi_sync_master::commit_trx(const char *, my_off_t): Assertion `rpl_semi_sync_master_off_times > thd->expected_semi_sync_offs' failed.
      

      ES 10.6.25-21 0fe345fff3a0463224ca714831303d40fb83648b (Debug, Clang 21.1.3-20250923) Build 23/01/2026

      Core was generated by `/test/EMD230126-mariadb-10.6.25-21-linux-x86_64-dbg/bin/mariadbd --no-defaults'.
      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 2691546)]
      (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  0x000079a65164526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x000079a6516288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000079a65162881b in __assert_fail_base (fmt=0x79a6517d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5b4bea2027f5 "rpl_semi_sync_master_off_times > thd->expected_semi_sync_offs", file=file@entry=0x5b4bea198eb3 "/test/10.6-es_dbg/sql/semisync_master.cc", line=line@entry=967, function=function@entry=0x5b4bea2a0fb8 "int Repl_semi_sync_master::commit_trx(const char *, my_off_t)") at ./assert/assert.c:94
      #6  0x000079a65163b507 in __assert_fail (assertion=0x5b4bea2027f5 "rpl_semi_sync_master_off_times > thd->expected_semi_sync_offs", file=0x5b4bea198eb3 "/test/10.6-es_dbg/sql/semisync_master.cc", line=967, function=0x5b4bea2a0fb8 "int Repl_semi_sync_master::commit_trx(const char *, my_off_t)") at ./assert/assert.c:103
      #7  0x00005b4beaf0db9c in Repl_semi_sync_master::commit_trx (this=0x5b4bebc035f0 <repl_semisync_master>, trx_wait_binlog_name=0x5b4bebbc5e82 <mysql_bin_log+202> "qa-roel-2-bin.000002", trx_wait_binlog_pos=346) at /test/10.6-es_dbg/sql/semisync_master.cc:967
      #8  0x00005b4beaf0d790 in Repl_semi_sync_master::wait_after_sync (this=0x5b4bebc035f0 <repl_semisync_master>, log_file=0x5b4bebbc5e80 <mysql_bin_log+200> "./qa-roel-2-bin.000002", log_pos=346) at /test/10.6-es_dbg/sql/semisync_master.cc:754
      #9  0x00005b4bea8657a1 in MYSQL_BIN_LOG::write (this=0x5b4bebbc5db8 <mysql_bin_log>, event_info=0x79a650765aa0, with_annotate=0x0) at /test/10.6-es_dbg/sql/log.cc:7047
      #10 0x00005b4beab647c4 in THD::binlog_query (this=0x79a540000d58, qtype=THD::STMT_QUERY_TYPE, query_arg=0x79a540013450 "CREATE TABLE t (value INT)", query_len=26, is_trans=false, direct=false, suppress_use=false, errcode=0)at /test/10.6-es_dbg/sql/sql_class.cc:8081
      #11 0x00005b4bead7ea06 in write_bin_log (thd=0x79a540000d58, clear_error=true, query=0x79a540013450 "CREATE TABLE t (value INT)", query_length=26, is_trans=false) at /test/10.6-es_dbg/sql/sql_table.cc:1023
      #12 0x00005b4bead8669e in mysql_create_table (thd=0x79a540000d58, create_table=0x79a540013550, create_info=0x79a650766290, alter_info=0x79a650766120) at /test/10.6-es_dbg/sql/sql_table.cc:5147
      #13 0x00005b4bead9b7ad in Sql_cmd_create_table_like::execute (this=0x79a5400134e8, thd=0x79a540000d58)at /test/10.6-es_dbg/sql/sql_table.cc:12648
      #14 0x00005b4beac7a556 in mysql_execute_command (thd=0x79a540000d58, is_called_from_prepared_stmt=false)at /test/10.6-es_dbg/sql/sql_parse.cc:6175
      #15 0x00005b4beac69e98 in mysql_parse (thd=0x79a540000d58, rawbuf=0x79a540013450 "CREATE TABLE t (value INT)", length=26, parser_state=0x79a650767a28) at /test/10.6-es_dbg/sql/sql_parse.cc:8229
      #16 0x00005b4beac6770c in dispatch_command (command=COM_QUERY, thd=0x79a540000d58, packet=0x79a54000aed9 "CREATE TABLE t (value INT)", packet_length=26, blocking=true) at /test/10.6-es_dbg/sql/sql_parse.cc:1915
      #17 0x00005b4beac6a93f in do_command (thd=0x79a540000d58, blocking=true)at /test/10.6-es_dbg/sql/sql_parse.cc:1428
      #18 0x00005b4beae46a8e in do_handle_one_connection (connect=0x5b4bee3f1178, put_in_cache=true) at /test/10.6-es_dbg/sql/sql_connect.cc:1386
      #19 0x00005b4beae46875 in handle_one_connection (arg=0x5b4bee3da6e8)at /test/10.6-es_dbg/sql/sql_connect.cc:1298
      #20 0x000079a65169ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #21 0x000079a651729c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      CS 12.3.0 fa36b269f139252b81d4384fbed07b167855cabb (Debug, Clang 21.1.3-20250923) Build 05/02/2026

      mariadbd: /test/12.3_dbg/sql/semisync_master.cc:968: int Repl_semi_sync_master::commit_trx(const char *, my_off_t): Assertion `rpl_semi_sync_master_off_times > thd->expected_semi_sync_offs' failed.
      

      CS 12.3.0 fa36b269f139252b81d4384fbed07b167855cabb (Debug, Clang 21.1.3-20250923) Build 05/02/2026

      Core was generated by `/test/MD050226-mariadb-12.3.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
      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 2937244)]
      (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  0x0000755e6684526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x0000755e668288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x0000755e6682881b in __assert_fail_base (fmt=0x755e669d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5c24f32a2c12 "rpl_semi_sync_master_off_times > thd->expected_semi_sync_offs", file=file@entry=0x5c24f31da153 "/test/12.3_dbg/sql/semisync_master.cc", line=line@entry=968, function=function@entry=0x5c24f339c9bf "int Repl_semi_sync_master::commit_trx(const char *, my_off_t)") at ./assert/assert.c:94
      #6  0x0000755e6683b507 in __assert_fail (assertion=0x5c24f32a2c12 "rpl_semi_sync_master_off_times > thd->expected_semi_sync_offs", file=0x5c24f31da153 "/test/12.3_dbg/sql/semisync_master.cc", line=968, function=0x5c24f339c9bf "int Repl_semi_sync_master::commit_trx(const char *, my_off_t)") at ./assert/assert.c:103
      #7  0x00005c24f420978c in Repl_semi_sync_master::commit_trx (this=0x5c24f5012168 <repl_semisync_master>, trx_wait_binlog_name=0x5c24f4fdaa02 <mysql_bin_log+202> "qa-roel-2-bin.000002", trx_wait_binlog_pos=347) at /test/12.3_dbg/sql/semisync_master.cc:967
      #8  0x00005c24f4209380 in Repl_semi_sync_master::wait_after_sync (this=0x5c24f5012168 <repl_semisync_master>, log_file=0x5c24f4fdaa00 <mysql_bin_log+200> "./qa-roel-2-bin.000002", log_pos=347) at /test/12.3_dbg/sql/semisync_master.cc:754
      #9  0x00005c24f3aa79e6 in MYSQL_BIN_LOG::write (this=0x5c24f4fda938 <mysql_bin_log>, event_info=0x755e5ff65700, with_annotate=0x0) at /test/12.3_dbg/sql/log.cc:9087
      #10 0x00005c24f3e09589 in THD::binlog_query (this=0x755cfc000d58, qtype=THD::STMT_QUERY_TYPE, query_arg=0x755cfc019f80 "CREATE TABLE t (value INT)", query_len=26, is_trans=false, direct=false, suppress_use=false, errcode=0)at /test/12.3_dbg/sql/sql_class.cc:8275
      #11 0x00005c24f4053756 in write_bin_log (thd=0x755cfc000d58, clear_error=true, query=0x755cfc019f80 "CREATE TABLE t (value INT)", query_length=26, is_trans=false) at /test/12.3_dbg/sql/sql_table.cc:1087
      #12 0x00005c24f40768d8 in mysql_create_table (thd=0x755cfc000d58, create_table=0x755cfc01a090, create_info=0x755e5ff65f18, alter_info=0x755e5ff65da0) at /test/12.3_dbg/sql/sql_table.cc:5376
      #13 0x00005c24f4074d9e in Sql_cmd_create_table_like::execute (this=0x755cfc01a018, thd=0x755cfc000d58)at /test/12.3_dbg/sql/sql_table.cc:13859
      #14 0x00005c24f3f3d94d in mysql_execute_command (thd=0x755cfc000d58, is_called_from_prepared_stmt=false) at /test/12.3_dbg/sql/sql_parse.cc:5911
      #15 0x00005c24f3f2ea58 in mysql_parse (thd=0x755cfc000d58, rawbuf=0x755cfc019f80 "CREATE TABLE t (value INT)", length=26, parser_state=0x755e5ff67a00) at /test/12.3_dbg/sql/sql_parse.cc:7950
      #16 0x00005c24f3f2c20e in dispatch_command (command=COM_QUERY, thd=0x755cfc000d58, packet=0x755cfc00b2d9 "CREATE TABLE t (value INT)", packet_length=26, blocking=true) at /test/12.3_dbg/sql/sql_parse.cc:1896
      #17 0x00005c24f3f2f4da in do_command (thd=0x755cfc000d58, blocking=true)at /test/12.3_dbg/sql/sql_parse.cc:1432
      #18 0x00005c24f412742e in do_handle_one_connection (connect=0x5c24f7bfcb58, put_in_cache=true) at /test/12.3_dbg/sql/sql_connect.cc:1503
      #19 0x00005c24f4127211 in handle_one_connection (arg=0x5c24f7b76088)at /test/12.3_dbg/sql/sql_connect.cc:1415
      #20 0x0000755e6689ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #21 0x0000755e66929c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Attachments

        Issue Links

          Activity

            People

              gkodinov Georgi Kodinov
              Roel Roel Van de Paar
              External_Contributor External_Contributor
              Kristian Nielsen Kristian Nielsen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 2.25h
                  2.25h

                  Git Integration

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