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

SIGSEGV in MDL_ticket::has_stronger_or_equal_type and Assertion `!table->s->tmp_table' failed in wait_while_table_is_used on CREATE TRIGGER

    XMLWordPrintable

Details

    • Not for Release Notes

    Description

      CREATE GLOBAL TEMPORARY TABLE t (c INT);
      CREATE TRIGGER tr AFTER INSERT ON t FOR EACH ROW INSERT INTO t VALUES (1);
      

      Leads to (note the non-repeated wait_while_table_is_used frame on UBASAN debug builds vs regular debug builds):

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

      Core was generated by `/test/MDEV-35915_EMD310725-mariadb-11.8.3-1-linux-x86_64-opt/bin/mariadbd --no-'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  MDL_ticket::has_stronger_or_equal_type (this=0x0, type=MDL_EXCLUSIVE)at /test/11.8-enterprise-global-tmp_opt/sql/mdl.cc:1912
      1912	    granted_incompat_map= m_lock->incompatible_granted_types_bitmap();
      [Current thread is 1 (LWP 2738825)]
      (gdb) bt
      #0  MDL_ticket::has_stronger_or_equal_type (this=0x0, type=MDL_EXCLUSIVE)at /test/11.8-enterprise-global-tmp_opt/sql/mdl.cc:1912
      #1  MDL_context::upgrade_shared_lock (this=0x764208000dc0, mdl_ticket=0x0, new_type=MDL_EXCLUSIVE, lock_wait_timeout=<error reading variable: That operation is not available on integers of more than 8 bytes.>)at /test/11.8-enterprise-global-tmp_opt/sql/mdl.cc:2670
      #2  0x00005ee7961569ed in wait_while_table_is_used (thd=thd@entry=0x764208000c68, table=0x764208033dc8, function=function@entry=HA_EXTRA_PREPARE_FOR_RENAME, lock_wait_timeout=86400)at /test/11.8-enterprise-global-tmp_opt/sql/sql_base.cc:1494
      #3  0x00005ee7962fff10 in wait_while_table_is_used (thd=0x764208000c68, table=0x764208033dc8, function=HA_EXTRA_PREPARE_FOR_RENAME)at /test/11.8-enterprise-global-tmp_opt/sql/sql_base.h:252
      #4  mysql_create_or_drop_trigger (thd=thd@entry=0x764208000c68, tables=0x7642080176f0, create=true)at /test/11.8-enterprise-global-tmp_opt/sql/sql_trigger.cc:641
      #5  0x00005ee796221a81 in mysql_execute_command (thd=thd@entry=0x764208000c68, is_called_from_prepared_stmt=false)at /test/11.8-enterprise-global-tmp_opt/sql/sql_parse.cc:5735
      #6  0x00005ee79621af51 in mysql_parse (thd=thd@entry=0x764208000c68, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7643295fe420)at /test/11.8-enterprise-global-tmp_opt/sql/sql_parse.cc:7947
      #7  0x00005ee7962193c4 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x764208000c68, packet=packet@entry=0x7642080088f9 "CREATE TRIGGER tr AFTER INSERT ON t FOR EACH ROW INSERT INTO t VALUES (1)", packet_length=packet_length@entry=73, blocking=true)at /test/11.8-enterprise-global-tmp_opt/sql/sql_parse.cc:1913
      #8  0x00005ee79621b361 in do_command (thd=thd@entry=0x764208000c68, blocking=true)at /test/11.8-enterprise-global-tmp_opt/sql/sql_parse.cc:1426
      #9  0x00005ee796370a9d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5ee79993c3b8, put_in_cache=true)at /test/11.8-enterprise-global-tmp_opt/sql/sql_connect.cc:1415
      #10 0x00005ee79637085f in handle_one_connection (arg=arg@entry=0x5ee79993c3b8)at /test/11.8-enterprise-global-tmp_opt/sql/sql_connect.cc:1327
      #11 0x00005ee796528c09 in pfs_spawn_thread (arg=0x5ee7998dbd28)at /test/11.8-enterprise-global-tmp_opt/storage/perfschema/pfs.cc:2198
      #12 0x0000764336c9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #13 0x0000764336d29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

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

      mariadbd: /test/11.8-enterprise-global-tmp_dbg/sql/sql_base.cc:1489: bool wait_while_table_is_used(THD *, TABLE *, enum ha_extra_function, ulonglong): Assertion `!table->s->tmp_table' failed.
      

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

      Core was generated by `/test/MDEV-35915_EMD310725-mariadb-11.8.3-1-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 2712541)]
      (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  0x000071a48384526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x000071a4838288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000071a48382881b in __assert_fail_base (fmt=0x71a4839d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x60105cce0a97 "!table->s->tmp_table", file=file@entry=0x60105cc4886b "/test/11.8-enterprise-global-tmp_dbg/sql/sql_base.cc", line=line@entry=1489, function=function@entry=0x60105ccfcc01 "bool wait_while_table_is_used(THD *, TABLE *, enum ha_extra_function, ulonglong)") at ./assert/assert.c:94
      #6  0x000071a48383b507 in __assert_fail (assertion=0x60105cce0a97 "!table->s->tmp_table", file=0x60105cc4886b "/test/11.8-enterprise-global-tmp_dbg/sql/sql_base.cc", line=1489, function=0x60105ccfcc01 "bool wait_while_table_is_used(THD *, TABLE *, enum ha_extra_function, ulonglong)") at ./assert/assert.c:103
      #7  0x000060105d72ecde in wait_while_table_is_used (thd=0x71a354000d58, table=0x71a35403cb88, function=HA_EXTRA_PREPARE_FOR_RENAME, lock_wait_timeout=86400)at /test/11.8-enterprise-global-tmp_dbg/sql/sql_base.cc:1489
      #8  0x000060105d7458ae in wait_while_table_is_used (thd=0x71a354000d58, table=0x71a35403cb88, function=HA_EXTRA_PREPARE_FOR_RENAME)at /test/11.8-enterprise-global-tmp_dbg/sql/sql_base.h:252
      #9  0x000060105d9fcbe2 in mysql_create_or_drop_trigger (thd=0x71a354000d58, tables=0x71a354019ef0, create=true)at /test/11.8-enterprise-global-tmp_dbg/sql/sql_trigger.cc:641
      #10 0x000060105d8a0f94 in mysql_execute_command (thd=0x71a354000d58, is_called_from_prepared_stmt=false)at /test/11.8-enterprise-global-tmp_dbg/sql/sql_parse.cc:5735
      #11 0x000060105d890444 in mysql_parse (thd=0x71a354000d58, rawbuf=0x71a354019d80 "CREATE TRIGGER tr AFTER INSERT ON t FOR EACH ROW INSERT INTO t VALUES (1)", length=73, parser_state=0x71a480ca29f0)at /test/11.8-enterprise-global-tmp_dbg/sql/sql_parse.cc:7947
      #12 0x000060105d88d7af in dispatch_command (command=COM_QUERY, thd=0x71a354000d58, packet=0x71a35400b0f9 "CREATE TRIGGER tr AFTER INSERT ON t FOR EACH ROW INSERT INTO t VALUES (1)", packet_length=73, blocking=true)at /test/11.8-enterprise-global-tmp_dbg/sql/sql_parse.cc:1913
      #13 0x000060105d89100d in do_command (thd=0x71a354000d58, blocking=true)at /test/11.8-enterprise-global-tmp_dbg/sql/sql_parse.cc:1426
      #14 0x000060105daae6b9 in do_handle_one_connection (connect=0x601060b21498, put_in_cache=true)at /test/11.8-enterprise-global-tmp_dbg/sql/sql_connect.cc:1415
      #15 0x000060105daae45e in handle_one_connection (arg=0x601060b31448)at /test/11.8-enterprise-global-tmp_dbg/sql/sql_connect.cc:1327
      #16 0x000071a48389ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #17 0x000071a483929c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      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:1489: bool wait_while_table_is_used(THD *, TABLE *, enum ha_extra_function, ulonglong): Assertion `!table->s->tmp_table' 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 2718098)]
      (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  0x000061ca35c67125 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  0x0000795794c4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #9  0x0000795794c288ff in __GI_abort () at ./stdlib/abort.c:79
      #10 0x0000795794c2881b in __assert_fail_base (fmt=0x795794dd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x61ca345e84e0 <str> "!table->s->tmp_table", file=file@entry=0x61ca345e5cec "/test/11.8-enterprise-global-tmp_dbg_san/sql/sql_base.cc", line=line@entry=1489, function=function@entry=0x61ca345e8520 <__PRETTY_FUNCTION__._Z24wait_while_table_is_usedP3THDP5TABLE17ha_extra_functiony> "bool wait_while_table_is_used(THD *, TABLE *, enum ha_extra_function, ulonglong)") at ./assert/assert.c:94
      #11 0x0000795794c3b507 in __assert_fail (assertion=0x61ca345e84e0 <str> "!table->s->tmp_table", file=0x61ca345e5cec "/test/11.8-enterprise-global-tmp_dbg_san/sql/sql_base.cc", line=1489, function=0x61ca345e8520 <__PRETTY_FUNCTION__._Z24wait_while_table_is_usedP3THDP5TABLE17ha_extra_functiony> "bool wait_while_table_is_used(THD *, TABLE *, enum ha_extra_function, ulonglong)") at ./assert/assert.c:103
      #12 0x000061ca35fcc118 in wait_while_table_is_used (thd=0x52b000165218, table=0x519000052d98, function=HA_EXTRA_PREPARE_FOR_RENAME, lock_wait_timeout=<optimized out>)at /test/11.8-enterprise-global-tmp_dbg_san/sql/sql_base.cc:1489
      #13 0x000061ca36974831 in mysql_create_or_drop_trigger (thd=<optimized out>, tables=0x52d0001725f0, create=<optimized out>)at /test/11.8-enterprise-global-tmp_dbg_san/sql/sql_trigger.cc:641
      #14 0x000061ca3647d835 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:5735
      #15 0x000061ca36458ef9 in mysql_parse (thd=thd@entry=0x52b000165218, rawbuf=rawbuf@entry=0x52d000172438 "CREATE TRIGGER tr AFTER INSERT ON t FOR EACH ROW INSERT INTO t VALUES (1)", length=<optimized out>, parser_state=parser_state@entry=0x7956a612b8a0)at /test/11.8-enterprise-global-tmp_dbg_san/sql/sql_parse.cc:7947
      #16 0x000061ca36452049 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
      #17 0x000061ca3645ba74 in do_command (thd=thd@entry=0x52b000165218, blocking=true)at /test/11.8-enterprise-global-tmp_dbg_san/sql/sql_parse.cc:1426
      #18 0x000061ca36bf1ded 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
      #19 0x000061ca36bf16a8 in handle_one_connection (arg=0x508000002d38)at /test/11.8-enterprise-global-tmp_dbg_san/sql/sql_connect.cc:1327
      #20 0x000061ca35287dad in asan_thread_start(void*) ()
      #21 0x0000795794c9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #22 0x0000795794d29c3c 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:1490: bool wait_while_table_is_used(THD *, TABLE *, enum ha_extra_function, ulonglong): Assertion `!table->s->tmp_table' 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 2750508)]
      (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  0x000078bdaea4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x000078bdaea288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000078bdaea2881b in __assert_fail_base (fmt=0x78bdaebd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x64cd1f892b74 "!table->s->tmp_table", file=file@entry=0x64cd1f88455b "/test/bb-12.0-nikita-global-tmp_dbg/sql/sql_base.cc", line=line@entry=1490, function=function@entry=0x64cd1f8aebaf "bool wait_while_table_is_used(THD *, TABLE *, enum ha_extra_function, ulonglong)") at ./assert/assert.c:94
      #6  0x000078bdaea3b507 in __assert_fail (assertion=0x64cd1f892b74 "!table->s->tmp_table", file=0x64cd1f88455b "/test/bb-12.0-nikita-global-tmp_dbg/sql/sql_base.cc", line=1490, function=0x64cd1f8aebaf "bool wait_while_table_is_used(THD *, TABLE *, enum ha_extra_function, ulonglong)") at ./assert/assert.c:103
      #7  0x000064cd202fc53e in wait_while_table_is_used (thd=0x78bc80000d58, table=0x78bc8003cf98, function=HA_EXTRA_PREPARE_FOR_RENAME, lock_wait_timeout=86400)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_base.cc:1490
      #8  0x000064cd203130be in wait_while_table_is_used (thd=0x78bc80000d58, table=0x78bc8003cf98, function=HA_EXTRA_PREPARE_FOR_RENAME)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_base.h:247
      #9  0x000064cd205d8f7d in mysql_create_or_drop_trigger (thd=0x78bc80000d58, tables=0x78bc8001a060, create=true)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_trigger.cc:640
      #10 0x000064cd2047ca6a in mysql_execute_command (thd=0x78bc80000d58, is_called_from_prepared_stmt=false)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_parse.cc:5694
      #11 0x000064cd2046c7f4 in mysql_parse (thd=0x78bc80000d58, rawbuf=0x78bc80019ef0 "CREATE TRIGGER tr AFTER INSERT ON t FOR EACH ROW INSERT INTO t VALUES (1)", length=73, parser_state=0x78bdac05ea10)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_parse.cc:7893
      #12 0x000064cd20469bc8 in dispatch_command (command=COM_QUERY, thd=0x78bc80000d58, packet=0x78bc8000b269 "CREATE TRIGGER tr AFTER INSERT ON t FOR EACH ROW INSERT INTO t VALUES (1)", packet_length=73, blocking=true)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_parse.cc:1881
      #13 0x000064cd2046d3a3 in do_command (thd=0x78bc80000d58, blocking=true)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_parse.cc:1420
      #14 0x000064cd2068b659 in do_handle_one_connection (connect=0x64cd23886af8, put_in_cache=true)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_connect.cc:1414
      #15 0x000064cd2068b3fe in handle_one_connection (arg=0x64cd23891b58)at /test/bb-12.0-nikita-global-tmp_dbg/sql/sql_connect.cc:1326
      #16 0x000078bdaea9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #17 0x000078bdaeb29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

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