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

INSERT into a table with ENGINE=DuckDB crashes the server when binary logging is enabled.

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      INSERT into a table with ENGINE=DuckDB crashes the server when binary logging is enabled. Assertion is similar to MDEV-38824

      --source include/have_log_bin.inc
       
      INSTALL SONAME 'ha_duckdb';
      CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=DuckDB;
      INSERT INTO t1 VALUES (1);
      

      Leads to:

      CS 13.1.0 f4299f0bbf38820794295bd4cae427544681cbd1 (Debug, Clang 18.1.3-11) Build 17/08/2026

      mariadbd: /test/13.1_dbg/sql/log_event_server.cc:2971: Gtid_log_event::Gtid_log_event(THD *, uint64, uint32, bool, enum_event_cache_type, uint16, bool, uint64, bool, bool): Assertion `ha_count_rw_2pc(thd_arg, thd_arg->in_multi_stmt_transaction_mode())' failed.
      

      CS 13.1.0 f4299f0bbf38820794295bd4cae427544681cbd1 (Debug, Clang 18.1.3-11) Build 17/08/2026

      Core was generated by `/test/MD170826-mariadb-13.1.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --loo'.
      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 2082674)]
      (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  0x0000715ff664527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x0000715ff66288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x0000715ff662881b in __assert_fail_base (fmt=0x715ff67d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5f6661a2e7a4 "ha_count_rw_2pc(thd_arg, thd_arg->in_multi_stmt_transaction_mode())", file=file@entry=0x5f6661a2d913 "/test/13.1_dbg/sql/log_event_server.cc", line=line@entry=2971, function=function@entry=0x5f6661a2e72f "Gtid_log_event::Gtid_log_event(THD *, uint64, uint32, bool, enum_event_cache_type, uint16, bool, uint64, bool, bool)") at ./assert/assert.c:96
      #6  0x0000715ff663b517 in __assert_fail (assertion=0x5f6661a2e7a4 "ha_count_rw_2pc(thd_arg, thd_arg->in_multi_stmt_transaction_mode())", file=0x5f6661a2d913 "/test/13.1_dbg/sql/log_event_server.cc", line=2971, function=0x5f6661a2e72f "Gtid_log_event::Gtid_log_event(THD *, uint64, uint32, bool, enum_event_cache_type, uint16, bool, uint64, bool, bool)")at ./assert/assert.c:105
      #7  0x00005f6660dd0e71 in Gtid_log_event::Gtid_log_event (this=0x715fd0068bc0, thd_arg=0x695ed4000d60, seq_no_arg=2, domain_id_arg=0, standalone=false, cache_type_arg=Log_event::EVENT_NO_CACHE, flags_arg=8, is_transactional=true, commit_id_arg=0, has_xid=true, ro_1pc=false)at /test/13.1_dbg/sql/log_event_server.cc:2970
      #8  0x00005f6660d9b306 in MYSQL_BIN_LOG::write_gtid_event (this=0x5f6662629aa8 <mysql_bin_log>, thd=0x695ed4000d60, cache_data=0x0, standalone=false, is_transactional=true, commit_id=0, commit_by_rotate=false, has_xid=true, is_ro_1pc=false)at /test/13.1_dbg/sql/log.cc:8386
      #9  0x00005f6660da55bc in MYSQL_BIN_LOG::write_transaction_or_stmt (this=0x5f6662629aa8 <mysql_bin_log>, entry=0x715fd0069718, commit_id=0, commit_by_rotate=false) at /test/13.1_dbg/sql/log.cc:11224
      #10 0x00005f6660da3be8 in MYSQL_BIN_LOG::trx_group_commit_with_engines (this=0x5f6662629aa8 <mysql_bin_log>, leader=0x715fd0069718, tail=0x715fd0069718, commit_by_rotate=false)at /test/13.1_dbg/sql/log.cc:10850
      #11 0x00005f6660da2f7b in MYSQL_BIN_LOG::trx_group_commit_leader (this=0x5f6662629aa8 <mysql_bin_log>, leader=0x715fd0069718)at /test/13.1_dbg/sql/log.cc:10794
      #12 0x00005f6660da2732 in MYSQL_BIN_LOG::write_transaction_with_group_commit (this=0x5f6662629aa8 <mysql_bin_log>, entry=0x715fd0069718)at /test/13.1_dbg/sql/log.cc:10587
      #13 0x00005f6660db30fe in MYSQL_BIN_LOG::write_transaction_to_binlog_events (this=0x5f6662629aa8 <mysql_bin_log>, entry=0x715fd0069718)at /test/13.1_dbg/sql/log.cc:10536
      #14 0x00005f6660da137b in MYSQL_BIN_LOG::write_transaction_to_binlog (this=0x5f6662629aa8 <mysql_bin_log>, thd=0x695ed4000d60, cache_mngr=0x695ed4043160, end_ev=0x715fd0069848, all=false, using_stmt_cache=true, using_trx_cache=true, is_ro_1pc=false)at /test/13.1_dbg/sql/log.cc:10163
      #15 0x00005f6660daf555 in binlog_flush_cache (thd=0x695ed4000d60, cache_mngr=0x695ed4043160, end_ev=0x715fd0069848, all=false, using_stmt=true, using_trx=true, is_ro_1pc=false)at /test/13.1_dbg/sql/log.cc:2215
      #16 0x00005f6660da9b26 in binlog_commit_flush_xid_caches (thd=0x695ed4000d60, cache_mngr=0x695ed4043160, all=false, xid=4)at /test/13.1_dbg/sql/log.cc:2486
      #17 0x00005f6660da9829 in MYSQL_BIN_LOG::log_and_order (this=0x5f6662629aa8 <mysql_bin_log>, thd=0x695ed4000d60, xid=4, all=false, need_prepare_ordered=false, need_commit_ordered=false)at /test/13.1_dbg/sql/log.cc:13063
      #18 0x00005f6660bd577d in ha_commit_trans (thd=0x695ed4000d60, all=false)at /test/13.1_dbg/sql/handler.cc:2049
      #19 0x00005f666097dfe9 in trans_commit_stmt (thd=0x695ed4000d60)at /test/13.1_dbg/sql/transaction.cc:498
      #20 0x00005f6660768d90 in mysql_execute_command (thd=0x695ed4000d60, is_called_from_prepared_stmt=false) at /test/13.1_dbg/sql/sql_parse.cc:6003
      #21 0x00005f6660757974 in mysql_parse (thd=0x695ed4000d60, rawbuf=0x695ed401a540 "INSERT INTO t1 VALUES (1)", length=25, parser_state=0x715fd006ba80) at /test/13.1_dbg/sql/sql_parse.cc:7968
      #22 0x00005f6660754c9d in dispatch_command (command=COM_QUERY, thd=0x695ed4000d60, packet=0x695ed400b771 "INSERT INTO t1 VALUES (1)", packet_length=25, blocking=true) at /test/13.1_dbg/sql/sql_parse.cc:1903
      #23 0x00005f6660758523 in do_command (thd=0x695ed4000d60, blocking=true)at /test/13.1_dbg/sql/sql_parse.cc:1437
      #24 0x00005f666095d969 in do_handle_one_connection (connect=0x5f6693d78cf0, put_in_cache=true) at /test/13.1_dbg/sql/sql_connect.cc:1514
      #25 0x00005f666095d70e in handle_one_connection (arg=0x5f6693dbfb90)at /test/13.1_dbg/sql/sql_connect.cc:1426
      #26 0x0000715ff669cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #27 0x0000715ff6729d6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed
      CS  10.6   dbg  170826  210ab6edf47fa73f3b77e974ed2e9357ccdd051c  No bug found
      CS  10.6   opt  170826  210ab6edf47fa73f3b77e974ed2e9357ccdd051c  No bug found
      CS  10.11  dbg  170826  0fe578244bc2904ae482d7836a7e3d4415e3482f  No bug found
      CS  10.11  opt  170826  0fe578244bc2904ae482d7836a7e3d4415e3482f  No bug found
      CS  11.4   dbg  170826  77c8f791618136002e5724ca81f365134b583a29  ha_count_rw_2pc(thd_arg, thd_arg->in_multi_stmt_transaction_mode())|SIGABRT|Gtid_log_event::Gtid_log_event|MYSQL_BIN_LOG::write_gtid_event|MYSQL_BIN_LOG::write_transaction_or_stmt|MYSQL_BIN_LOG::trx_group_commit_leader
      CS  11.4   opt  170826  77c8f791618136002e5724ca81f365134b583a29  No bug found
      CS  11.8   dbg  170826  d26f9ab217a7fcf9d4eccc62c01020ff275ff42e  ha_count_rw_2pc(thd_arg, thd_arg->in_multi_stmt_transaction_mode())|SIGABRT|Gtid_log_event::Gtid_log_event|MYSQL_BIN_LOG::write_gtid_event|MYSQL_BIN_LOG::write_transaction_or_stmt|MYSQL_BIN_LOG::trx_group_commit_with_engines
      CS  11.8   opt  170826  d26f9ab217a7fcf9d4eccc62c01020ff275ff42e  No bug found
      CS  12.3   dbg  170826  91156c3de58762196605150ab3f756fe952592d1  ha_count_rw_2pc(thd_arg, thd_arg->in_multi_stmt_transaction_mode())|SIGABRT|Gtid_log_event::Gtid_log_event|MYSQL_BIN_LOG::write_gtid_event|MYSQL_BIN_LOG::write_transaction_or_stmt|MYSQL_BIN_LOG::trx_group_commit_with_engines
      CS  12.3   opt  170826  91156c3de58762196605150ab3f756fe952592d1  No bug found
      CS  13.0   dbg  170826  a848493c6fe031f23606144420c1ca1e467cbd81  ha_count_rw_2pc(thd_arg, thd_arg->in_multi_stmt_transaction_mode())|SIGABRT|Gtid_log_event::Gtid_log_event|MYSQL_BIN_LOG::write_gtid_event|MYSQL_BIN_LOG::write_transaction_or_stmt|MYSQL_BIN_LOG::trx_group_commit_with_engines
      CS  13.0   opt  170826  a848493c6fe031f23606144420c1ca1e467cbd81  No bug found
      CS  13.1   dbg  170826  f4299f0bbf38820794295bd4cae427544681cbd1  ha_count_rw_2pc(thd_arg, thd_arg->in_multi_stmt_transaction_mode())|SIGABRT|Gtid_log_event::Gtid_log_event|MYSQL_BIN_LOG::write_gtid_event|MYSQL_BIN_LOG::write_transaction_or_stmt|MYSQL_BIN_LOG::trx_group_commit_with_engines
      CS  13.1   opt  170826  f4299f0bbf38820794295bd4cae427544681cbd1  No bug found
      ES  11.4   dbg  060526  90f707057d44f1b5c013a0c3672fd12f32ea7085  No bug found
      ES  11.4   opt  060526  90f707057d44f1b5c013a0c3672fd12f32ea7085  No bug found
      ES  11.8   dbg  060526  1499789de285a8109d68d79347de0281865b28f4  No bug found
      ES  11.8   opt  060526  1499789de285a8109d68d79347de0281865b28f4  No bug found
      

      Attachments

        Issue Links

          Activity

            People

              drrtuy Roman
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 0.5h
                  0.5h

                  Git Integration

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