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

Assertion failed in close_thread_tables on UPDATE referring bad field

    XMLWordPrintable

Details

    • Not for Release Notes

    Description

      CREATE GLOBAL TEMPORARY TABLE t(c INT);
      UPDATE t SET foo=CONCAT(foo,0);
      

      Leads to:

      MDEV-35915 ES 11.8.3-1 267fc98bf48033db5cf8b3bbffd9d3aea4e9ea8e (Debug, UBASAN, Clang) Build 31/07/2025

      mariadbd: /test/11.8-enterprise-global-tmp_dbg_san/sql/sql_base.cc:875: int close_thread_tables(THD *): Assertion `thd->transaction->stmt.is_empty() || thd->in_sub_stmt || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)' failed.
      

      MDEV-35915 ES 11.8.3-1 267fc98bf48033db5cf8b3bbffd9d3aea4e9ea8e (Debug, UBASAN, Clang) Build 31/07/2025

      Core was generated by `/test/MDEV-35915_UBASAN_EMD310725-mariadb-11.8.3-1-linux-x86_64-dbg/bin/mariadb'.
      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 1120244)]
      (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  0x00005f4f39060125 in handle_fatal_signal (sig=<optimized out>)at /test/11.8-enterprise-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  0x00007b460004526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #9  0x00007b46000288ff in __GI_abort () at ./stdlib/abort.c:79
      #10 0x00007b460002881b in __assert_fail_base (fmt=0x7b46001d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5f4f379e1020 <str> "thd->transaction->stmt.is_empty() || thd->in_sub_stmt || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)", file=file@entry=0x5f4f379decec "/test/11.8-enterprise-global-tmp_dbg_san/sql/sql_base.cc", line=line@entry=875, function=function@entry=0x5f4f379e10c0 <__PRETTY_FUNCTION__._Z19close_thread_tablesP3THD> "int close_thread_tables(THD *)") at ./assert/assert.c:94
      #11 0x00007b460003b507 in __assert_fail (assertion=0x5f4f379e1020 <str> "thd->transaction->stmt.is_empty() || thd->in_sub_stmt || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)", file=0x5f4f379decec "/test/11.8-enterprise-global-tmp_dbg_san/sql/sql_base.cc", line=875, function=0x5f4f379e10c0 <__PRETTY_FUNCTION__._Z19close_thread_tablesP3THD> "int close_thread_tables(THD *)") at ./assert/assert.c:103
      #12 0x00005f4f393c0e74 in close_thread_tables (thd=0x52b000165218)at /test/11.8-enterprise-global-tmp_dbg_san/sql/sql_base.cc:874
      #13 0x00005f4f393e776b in open_tables_for_query (thd=0x52b000165218, tables=<optimized out>, table_count=<optimized out>, flags=<optimized out>, prelocking_strategy=<optimized out>)at /test/11.8-enterprise-global-tmp_dbg_san/sql/sql_base.cc:5888
      #14 0x00005f4f39b34cd9 in Sql_cmd_dml::prepare (this=0x52d000173158, thd=<optimized out>)at /test/11.8-enterprise-global-tmp_dbg_san/sql/sql_select.cc:34419
      #15 0x00005f4f39b35bdb in Sql_cmd_dml::execute (this=<optimized out>, thd=0x52b000165218)at /test/11.8-enterprise-global-tmp_dbg_san/sql/sql_select.cc:34482
      #16 0x00005f4f39874b7d in mysql_execute_command (thd=0x52b000165218, is_called_from_prepared_stmt=<optimized out>)at /test/11.8-enterprise-global-tmp_dbg_san/sql/sql_parse.cc:4448
      #17 0x00005f4f39851ef9 in mysql_parse (thd=thd@entry=0x52b000165218, rawbuf=rawbuf@entry=0x52d000172438 "UPDATE t SET foo=CONCAT(foo,0)", length=<optimized out>, parser_state=parser_state@entry=0x7b44f812b8a0)at /test/11.8-enterprise-global-tmp_dbg_san/sql/sql_parse.cc:7947
      #18 0x00005f4f3984b049 in dispatch_command (command=<optimized out>, thd=0x52b000165218, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>)at /test/11.8-enterprise-global-tmp_dbg_san/sql/sql_parse.cc:1913
      #19 0x00005f4f39854a74 in do_command (thd=thd@entry=0x52b000165218, blocking=true)at /test/11.8-enterprise-global-tmp_dbg_san/sql/sql_parse.cc:1426
      #20 0x00005f4f39feaded in do_handle_one_connection (connect=<optimized out>, connect@entry=0x508000002d38, put_in_cache=true)at /test/11.8-enterprise-global-tmp_dbg_san/sql/sql_connect.cc:1415
      #21 0x00005f4f39fea6a8 in handle_one_connection (arg=0x508000002d38)at /test/11.8-enterprise-global-tmp_dbg_san/sql/sql_connect.cc:1327
      #22 0x00005f4f38680dad in asan_thread_start(void*) ()
      #23 0x00007b460009ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #24 0x00007b4600129c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      MDEV-35915 CS 12.0.1 21489191d3683c5655afa170533480c86843ecba (Debug, Clang) Build 04/08/2025

      mariadbd: /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_base.cc:876: int close_thread_tables(THD *): Assertion `thd->transaction->stmt.is_empty() || thd->in_sub_stmt || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)' failed.
      

      MDEV-35915 CS 12.0.1 21489191d3683c5655afa170533480c86843ecba (Debug, Clang) Build 04/08/2025

      Core was generated by `/test/MDEV-35915_MD040825-mariadb-12.0.1-linux-x86_64-dbg/bin/mariadbd --no-def'.
      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 1106900)]
      (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  0x00007fbcd064526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007fbcd06288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007fbcd062881b in __assert_fail_base (fmt=0x7fbcd07d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x62d68dcfc205 "thd->transaction->stmt.is_empty() || thd->in_sub_stmt || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)", file=file@entry=0x62d68dda355b "/test/bb-12.0-nikita-global-tmp_dbg/sql/sql_base.cc", line=line@entry=876, function=function@entry=0x62d68dd18e5d "int close_thread_tables(THD *)")at ./assert/assert.c:94
      #6  0x00007fbcd063b507 in __assert_fail (assertion=0x62d68dcfc205 "thd->transaction->stmt.is_empty() || thd->in_sub_stmt || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)", file=0x62d68dda355b "/test/bb-12.0-nikita-global-tmp_dbg/sql/sql_base.cc", line=876, function=0x62d68dd18e5d "int close_thread_tables(THD *)")at ./assert/assert.c:103
      #7  0x000062d68e81a0f6 in close_thread_tables (thd=0x7fbba0000d58)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_base.cc:875
      #8  0x000062d68e825266 in open_tables_for_query (thd=0x7fbba0000d58, tables=0x7fbba0019fd8, table_count=0x7fbba001ab68, flags=0, prelocking_strategy=0x7fbba001aba8)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_base.cc:5903
      #9  0x000062d68ea5373f in Sql_cmd_dml::prepare (this=0x7fbba001ab50, thd=0x7fbba0000d58)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_select.cc:34585
      #10 0x000062d68ea539af in Sql_cmd_dml::execute (this=0x7fbba001ab50, thd=0x7fbba0000d58)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_select.cc:34648
      #11 0x000062d68e9953bb in mysql_execute_command (thd=0x7fbba0000d58, is_called_from_prepared_stmt=false)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_parse.cc:4407
      #12 0x000062d68e98b7f4 in mysql_parse (thd=0x7fbba0000d58, rawbuf=0x7fbba0019ef0 "UPDATE t SET foo=CONCAT(foo,0)", length=30, parser_state=0x7fbccc3fda10)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_parse.cc:7893
      #13 0x000062d68e988bc8 in dispatch_command (command=COM_QUERY, thd=0x7fbba0000d58, packet=0x7fbba000b269 "UPDATE t SET foo=CONCAT(foo,0)", packet_length=30, blocking=true) at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_parse.cc:1881
      #14 0x000062d68e98c3a3 in do_command (thd=0x7fbba0000d58, blocking=true)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_parse.cc:1420
      #15 0x000062d68ebaa659 in do_handle_one_connection (connect=0x62d69133dac8, put_in_cache=true)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_connect.cc:1414
      #16 0x000062d68ebaa3fe in handle_one_connection (arg=0x62d691348b28)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_connect.cc:1326
      #17 0x00007fbcd069ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #18 0x00007fbcd0729c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Optimized builds give:

      MDEV-35915 CS 12.0.1 21489191d3683c5655afa170533480c86843ecba (Optimized, Clang) Build 04/08/2025

      11.8.3-opt>UPDATE t SET foo=CONCAT(foo,0);
      ERROR 1054 (42S22): Unknown column 'foo' in 'SET'
      

      Affects at least InnoDB + MyISAM

      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:
                Resolved:

                Git Integration

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