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

Assertion `!mysql_bin_log.is_open()' failed in THD::mark_tmp_table_as_free_for_reuse on ALTER

    XMLWordPrintable

Details

    • Not for Release Notes

    Description

      --source include/have_binlog_format_statement.inc
      --source include/have_innodb.inc
      --source include/master-slave.inc
      SET default_storage_engine=InnoDB;
      CREATE TEMPORARY TABLE t (a CHAR(1),b CHAR(1));
      --error ER_CANNOT_DISCARD_TEMPORARY_TABLE
      ALTER TABLE t DISCARD TABLESPACE;
      --sync_slave_with_master
      DROP TABLE t;
      --source include/rpl_end.inc
      

      Leads to:

      MDEV-35915-v12 CS 12.2.0 b6b856c27fd4c7cc13191ba95848700c0e31e955 (Debug, Clang 21.1.3-20250923) Build 05/03/2026

      mariadbd: /test/bb-12.2-nikita-global-tmp_dbg/sql/temporary_tables.cc:947: void THD::mark_tmp_table_as_free_for_reuse(TABLE *): Assertion `!mysql_bin_log.is_open()' failed.
      

      MDEV-35915-v12 CS 12.2.0 b6b856c27fd4c7cc13191ba95848700c0e31e955 (Debug, Clang 21.1.3-20250923) Build 05/03/2026

      Core was generated by `/test/MDEV-35915_v12_MD050326-mariadb-12.2.0-linux-x86_64-dbg/bin/mariadbd --de'.
      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 3122893)]
      (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  0x000076003004526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007600300288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000076003002881b in __assert_fail_base (fmt=0x7600301d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5a5b3f54a24b "!mysql_bin_log.is_open()", file=file@entry=0x5a5b3f3fe3b2 "/test/bb-12.2-nikita-global-tmp_dbg/sql/temporary_tables.cc", line=line@entry=947, function=function@entry=0x5a5b3f41a50d "void THD::mark_tmp_table_as_free_for_reuse(TABLE *)") at ./assert/assert.c:94
      #6  0x000076003003b507 in __assert_fail (assertion=0x5a5b3f54a24b "!mysql_bin_log.is_open()", file=0x5a5b3f3fe3b2 "/test/bb-12.2-nikita-global-tmp_dbg/sql/temporary_tables.cc", line=947, function=0x5a5b3f41a50d "void THD::mark_tmp_table_as_free_for_reuse(TABLE *)") at ./assert/assert.c:103
      #7  0x00005a5b403dc5f6 in THD::mark_tmp_table_as_free_for_reuse (this=0x75ff1c000d58, table=0x75ff1c021788)at /test/bb-12.2-nikita-global-tmp_dbg/sql/temporary_tables.cc:947
      #8  0x00005a5b403dc407 in THD::mark_tmp_tables_as_free_for_reuse (this=0x75ff1c000d58)at /test/bb-12.2-nikita-global-tmp_dbg/sql/temporary_tables.cc:898
      #9  0x00005a5b3ff36b9f in close_thread_tables (thd=0x75ff1c000d58)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_base.cc:949
      #10 0x00005a5b3ff3679d in close_thread_tables_for_query (thd=0x75ff1c000d58)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_base.cc:822
      #11 0x00005a5b400a204c in mysql_execute_command (thd=0x75ff1c000d58, is_called_from_prepared_stmt=false)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_parse.cc:5972
      #12 0x00005a5b40092ea8 in mysql_parse (thd=0x75ff1c000d58, rawbuf=0x75ff1c015a60 "ALTER TABLE t DISCARD TABLESPACE", length=32, parser_state=0x76002d3fda10)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_parse.cc:7913
      #13 0x00005a5b40090689 in dispatch_command (command=COM_QUERY, thd=0x75ff1c000d58, packet=0x75ff1c00b339 "ALTER TABLE t DISCARD TABLESPACE", packet_length=32, blocking=true)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_parse.cc:1899
      #14 0x00005a5b4009392a in do_command (thd=0x75ff1c000d58, blocking=true)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_parse.cc:1438
      #15 0x00005a5b4028633e in do_handle_one_connection (connect=0x5a5b43de3408, put_in_cache=true)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_connect.cc:1414
      #16 0x00005a5b40286121 in handle_one_connection (arg=0x5a5b43de3408)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_connect.cc:1326
      #17 0x000076003009ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #18 0x0000760030129c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      And a slightly different stack on UBASAN builds:

      MDEV-35915-v12 CS 12.2.0 b6b856c27fd4c7cc13191ba95848700c0e31e955 (Debug, UBASAN, Clang 21.1.3-20250923) Build 05/03/2026

      Core was generated by `/test/MDEV-35915_v12_UBASAN_MD050326-mariadb-12.2.0-linux-x86_64-dbg/bin/mariad'.
      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 3124190)]
      (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=6)at ./nptl/pthread_kill.c:89
      #3  0x00005642c0831ae0 in handle_fatal_signal (sig=<optimized out>)at /test/bb-12.2-nikita-global-tmp_dbg_san/sql/signal_handler.cc:298
      #4  <signal handler called>
      #5  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
      #6  __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
      #7  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)at ./nptl/pthread_kill.c:89
      #8  0x00007b974224526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #9  0x00007b97422288ff in __GI_abort () at ./stdlib/abort.c:79
      #10 0x00007b974222881b in __assert_fail_base (fmt=0x7b97423d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5642bf5eb580 <str> "!mysql_bin_log.is_open()", file=file@entry=0x5642bf5e9f00 "/test/bb-12.2-nikita-global-tmp_dbg_san/sql/temporary_tables.cc", line=line@entry=947, function=function@entry=0x5642bf5eb520 <__PRETTY_FUNCTION__._ZN3THD32mark_tmp_table_as_free_for_reuseEP5TABLE> "void THD::mark_tmp_table_as_free_for_reuse(TABLE *)") at ./assert/assert.c:94
      #11 0x00007b974223b507 in __assert_fail (assertion=0x5642bf5eb580 <str> "!mysql_bin_log.is_open()", file=0x5642bf5e9f00 "/test/bb-12.2-nikita-global-tmp_dbg_san/sql/temporary_tables.cc", line=947, function=0x5642bf5eb520 <__PRETTY_FUNCTION__._ZN3THD32mark_tmp_table_as_free_for_reuseEP5TABLE> "void THD::mark_tmp_table_as_free_for_reuse(TABLE *)")at ./assert/assert.c:103
      #12 0x00005642c1d1173c in THD::mark_tmp_table_as_free_for_reuse (this=this@entry=0x7a47411ee218, table=table@entry=0x7927410b1098)at /test/bb-12.2-nikita-global-tmp_dbg_san/sql/temporary_tables.cc:947
      #13 0x00005642c1d108c1 in THD::mark_tmp_tables_as_free_for_reuse (this=0x7a47411ee218)at /test/bb-12.2-nikita-global-tmp_dbg_san/sql/temporary_tables.cc:898
      #14 0x00005642c0b8ead5 in close_thread_tables (thd=0x7a47411ee218)at /test/bb-12.2-nikita-global-tmp_dbg_san/sql/sql_base.cc:949
      #15 0x00005642c10b0392 in mysql_execute_command (thd=0x7a47411ee218, is_called_from_prepared_stmt=<optimized out>)at /test/bb-12.2-nikita-global-tmp_dbg_san/sql/sql_parse.cc:5972
      #16 0x00005642c1088f59 in mysql_parse (thd=thd@entry=0x7a47411ee218, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x77967f5417c0)at /test/bb-12.2-nikita-global-tmp_dbg_san/sql/sql_parse.cc:7913
      #17 0x00005642c1082712 in dispatch_command (command=<optimized out>, thd=0x7a47411ee218, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>)at /test/bb-12.2-nikita-global-tmp_dbg_san/sql/sql_parse.cc:1899
      #18 0x00005642c108b38b in do_command (thd=thd@entry=0x7a47411ee218, blocking=<optimized out>)at /test/bb-12.2-nikita-global-tmp_dbg_san/sql/sql_parse.cc:1438
      #19 0x00005642c188ffcd in do_handle_one_connection (connect=<optimized out>, connect@entry=0x7817410292b8, put_in_cache=<optimized out>)at /test/bb-12.2-nikita-global-tmp_dbg_san/sql/sql_connect.cc:1414
      #20 0x00005642c188fad6 in handle_one_connection (arg=0x7817410292b8)at /test/bb-12.2-nikita-global-tmp_dbg_san/sql/sql_connect.cc:1326
      #21 0x00005642c00477ab in asan_thread_start(void*) ()
      #22 0x00007b974229ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #23 0x00007b9742329c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      No SAN errors observed.

      Attachments

        Issue Links

          Activity

            People

              nikitamalyavin Nikita Malyavin
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.