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

Assertion `s->tmp_table != NO_TMP_TABLE || s->tdc->ref_count > 0' failed in TABLE::init on SELECT

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      CREATE GLOBAL TEMPORARY TABLE t (c INT);
      LOCK TABLES t READ;
      SET pseudo_slave_mode=1;
      INSERT t VALUES (1);
      SELECT * FROM t;
      

      Leads to:

      MDEV-35915 CS 12.2.0 228260ead7d9343e81a6d73bc0eb7ec96718d917 (Debug, Clang 21.1.3-20250923) Build 27/12/2025

      mariadbd: /test/bb-12.2-nikita-global-tmp_dbg/sql/table.cc:5953: void TABLE::init(THD *, TABLE_LIST *): Assertion `s->tmp_table != NO_TMP_TABLE || s->tdc->ref_count > 0' failed.
      

      MDEV-35915 CS 12.2.0 228260ead7d9343e81a6d73bc0eb7ec96718d917 (Debug, Clang 21.1.3-20250923) Build 27/12/2025

      Core was generated by `/test/MDEV-35915_v9_MD271225-mariadb-12.2.0-linux-x86_64-dbg/bin/mariadbd --no-'.
      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 3784332)]
      (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  0x0000753cdbe4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x0000753cdbe288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x0000753cdbe2881b in __assert_fail_base (fmt=0x753cdbfd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5b3e30322cd4 "s->tmp_table != NO_TMP_TABLE || s->tdc->ref_count > 0", file=file@entry=0x5b3e304845be "/test/bb-12.2-nikita-global-tmp_dbg/sql/table.cc", line=line@entry=5953, function=function@entry=0x5b3e30475b43 "void TABLE::init(THD *, TABLE_LIST *)") at ./assert/assert.c:94
      #6  0x0000753cdbe3b507 in __assert_fail (assertion=0x5b3e30322cd4 "s->tmp_table != NO_TMP_TABLE || s->tdc->ref_count > 0", file=0x5b3e304845be "/test/bb-12.2-nikita-global-tmp_dbg/sql/table.cc", line=5953, function=0x5b3e30475b43 "void TABLE::init(THD *, TABLE_LIST *)")at ./assert/assert.c:103
      #7  0x00005b3e3113a911 in TABLE::init (this=0x753b8c028268, thd=0x753b8c000d58, tl=0x753b8c01a548)at /test/bb-12.2-nikita-global-tmp_dbg/sql/table.cc:5953
      #8  0x00005b3e30e50bcc in open_table (thd=0x753b8c000d58, table_list=0x753b8c01a548, ot_ctx=0x753cd8078b78)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_base.cc:2097
      #9  0x00005b3e30e565b0 in open_and_process_table (thd=0x753b8c000d58, tables=0x753b8c01a548, counter=0x753cd8078c2c, flags=0, prelocking_strategy=0x753cd8078c90, has_prelocking_list=false, ot_ctx=0x753cd8078b78)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_base.cc:4293
      #10 0x00005b3e30e553eb in open_tables (thd=0x753b8c000d58, options=@0x753b8c006734: {m_options = DDL_options_st::OPT_NONE}, start=0x753cd8078c40, counter=0x753cd8078c2c, flags=0, prelocking_strategy=0x753cd8078c90)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_base.cc:4776
      #11 0x00005b3e30e581aa in open_and_lock_tables (thd=0x753b8c000d58, options=@0x753b8c006734: {m_options = DDL_options_st::OPT_NONE}, tables=0x753b8c01a548, derived=true, flags=0, prelocking_strategy=0x753cd8078c90)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_base.cc:5764
      #12 0x00005b3e30cda83e in open_and_lock_tables (thd=0x753b8c000d58, tables=0x753b8c01a548, derived=true, flags=0)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_base.h:544
      #13 0x00005b3e30fbb1ca in execute_sqlcom_select (thd=0x753b8c000d58, all_tables=0x753b8c01a548)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_parse.cc:6109
      #14 0x00005b3e30fb1cf3 in mysql_execute_command (thd=0x753b8c000d58, is_called_from_prepared_stmt=false)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_parse.cc:3971
      #15 0x00005b3e30faac18 in mysql_parse (thd=0x753b8c000d58, rawbuf=0x753b8c019e80 "SELECT * FROM t", length=15, parser_state=0x753cd807aa10)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_parse.cc:7911
      #16 0x00005b3e30fa83f9 in dispatch_command (command=COM_QUERY, thd=0x753b8c000d58, packet=0x753b8c00b1f9 "SELECT * FROM t", packet_length=15, blocking=true)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_parse.cc:1898
      #17 0x00005b3e30fab69a in do_command (thd=0x753b8c000d58, blocking=true)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_parse.cc:1437
      #18 0x00005b3e3119e04e in do_handle_one_connection (connect=0x5b3e33fb3108, put_in_cache=true)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_connect.cc:1414
      #19 0x00005b3e3119de31 in handle_one_connection (arg=0x5b3e3403b4b8)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_connect.cc:1326
      #20 0x0000753cdbe9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #21 0x0000753cdbf29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Attachments

        Issue Links

          Activity

            People

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