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

Assertion `thd->mdl_context.is_lock_owner()...fails in close_thread_table, SIGSEGV in mysql_create_like_table

    XMLWordPrintable

Details

    • Can result in hang or crash
    • Q3/2025 Maintenance

    Description

      CLI:

      # mysqld options required for replay: --log-bin 
      CREATE TABLE t (c INT);
      SET SESSION binlog_format=STATEMENT;
      CREATE TEMPORARY TABLE t LIKE information_schema.processlist;
      

      MTR:

      --source include/have_binlog_format_statement.inc
      CREATE TABLE t (c INT);
      CREATE TEMPORARY TABLE t LIKE information_schema.processlist;
      

      MyISAM and InnoDB both affected.

      Leads to:

      CS 12.1.0 6a2afb42ba86188ccda0972f9c2df363f34e10a0 (Debug) Build 10/06/2025

      mariadbd: /test/12.1_dbg/sql/sql_base.cc:1037: void close_thread_table(THD *, TABLE **): Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->s->db.str, table->s->table_name.str, MDL_SHARED) || thd->mdl_context.is_lock_warrantee(MDL_key::TABLE, table->s->db.str, table->s->table_name.str, MDL_SHARED)' failed.
      

      CS 12.1.0 6a2afb42ba86188ccda0972f9c2df363f34e10a0 (Debug) Build 10/06/2025

      Core was generated by `/test/MD100625-mariadb-12.1.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
      Program terminated with signal SIGABRT, Aborted.
      Download failed: Invalid argument.  Continuing without source file ./nptl/./nptl/pthread_kill.c.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
       
      [Current thread is 1 (LWP 3570909)]
      (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  0x00007f394dc4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007f394dc288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007f394dc2881b in __assert_fail_base (fmt=0x7f394ddd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55d0ba8dbf81 "thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->s->db.str, table->s->table_name.str, MDL_SHARED) || thd->mdl_context.is_lock_warrantee(MDL_key::TABLE, table->s->db.str, table->s->table_name.str,"..., file=file@entry=0x55d0ba8dbf62 "/test/12.1_dbg/sql/sql_base.cc", line=line@entry=1037, function=function@entry=0x55d0ba7ab9ec "void close_thread_table(THD *, TABLE **)") at ./assert/assert.c:94
      #6  0x00007f394dc3b507 in __assert_fail (assertion=0x55d0ba8dbf81 "thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->s->db.str, table->s->table_name.str, MDL_SHARED) || thd->mdl_context.is_lock_warrantee(MDL_key::TABLE, table->s->db.str, table->s->table_name.str,"..., file=0x55d0ba8dbf62 "/test/12.1_dbg/sql/sql_base.cc", line=1037, function=0x55d0ba7ab9ec "void close_thread_table(THD *, TABLE **)")at ./assert/assert.c:103
      #7  0x000055d0bb2c5c02 in close_thread_table (thd=0x7f381c000d58, table_ptr=0x7f381c000ed0) at /test/12.1_dbg/sql/sql_base.cc:1030
      #8  0x000055d0bb596af6 in mysql_create_like_table (thd=0x7f381c000d58, table=0x7f381c01a0d0, src_table=0x7f381c01a888, create_info=0x7f394c11afb8)at /test/12.1_dbg/sql/sql_table.cc:6001
      #9  0x000055d0bb59567d in Sql_cmd_create_table_like::execute (this=0x7f381c01a058, thd=0x7f381c000d58)at /test/12.1_dbg/sql/sql_table.cc:13632
      #10 0x000055d0bb447d6d in mysql_execute_command (thd=0x7f381c000d58, is_called_from_prepared_stmt=false) at /test/12.1_dbg/sql/sql_parse.cc:5861
      #11 0x000055d0bb4370a4 in mysql_parse (thd=0x7f381c000d58, rawbuf=0x7f381c019f80 "CREATE TEMPORARY TABLE t LIKE information_schema.processlist", length=60, parser_state=0x7f394c11ca10)at /test/12.1_dbg/sql/sql_parse.cc:7882
      #12 0x000055d0bb434478 in dispatch_command (command=COM_QUERY, thd=0x7f381c000d58, packet=0x7f381c00b2f9 "CREATE TEMPORARY TABLE t LIKE information_schema.processlist", packet_length=60, blocking=true)at /test/12.1_dbg/sql/sql_parse.cc:1877
      #13 0x000055d0bb437c53 in do_command (thd=0x7f381c000d58, blocking=true)at /test/12.1_dbg/sql/sql_parse.cc:1416
      #14 0x000055d0bb655629 in do_handle_one_connection (connect=0x55d0bee2ccf8, put_in_cache=true) at /test/12.1_dbg/sql/sql_connect.cc:1414
      #15 0x000055d0bb6553ce in handle_one_connection (arg=0x55d0beefa048)at /test/12.1_dbg/sql/sql_connect.cc:1326
      #16 0x00007f394dc9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #17 0x00007f394dd29c3c 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  060625  643319a7fb1e273797c2a1e46d76cfac0fa1da8f  No bug found                  
      CS  10.6   opt  060625  643319a7fb1e273797c2a1e46d76cfac0fa1da8f  No bug found                  
      CS  10.11  dbg  060625  11d1ac7285221ab4df7d9ef7cc8ee949b01c9b32  No bug found                  
      CS  10.11  opt  060625  11d1ac7285221ab4df7d9ef7cc8ee949b01c9b32  No bug found                  
      CS  11.4   dbg  060625  8c6cbb336081a5e1ad781df4a9778b61e3b4d73f  No bug found                  
      CS  11.4   opt  060625  8c6cbb336081a5e1ad781df4a9778b61e3b4d73f  No bug found                  
      CS  11.8   dbg  060625  67e6fdee05ead4974fe632e91c38941ade369b0c  No bug found                  
      CS  11.8   opt  060625  67e6fdee05ead4974fe632e91c38941ade369b0c  No bug found                  
      CS  12.0   dbg  060625  f1102da37a3dcdc8b92e0205f0a8bd878704b168  thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->s->db.str, table->s->table_name.str, MDL_SHARED) || thd->mdl_context.is_lock_warrantee(MDL_key::TABLE, table->s->db.str, table->s->table_name.str, MDL_SHARED)|SIGABRT|close_thread_table|mysql_create_like_table|Sql_cmd_create_table_like::execute|mysql_execute_command
      CS  12.0   opt  060625  f1102da37a3dcdc8b92e0205f0a8bd878704b168  No bug found                  
      CS  12.1   dbg  100625  6a2afb42ba86188ccda0972f9c2df363f34e10a0  thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->s->db.str, table->s->table_name.str, MDL_SHARED) || thd->mdl_context.is_lock_warrantee(MDL_key::TABLE, table->s->db.str, table->s->table_name.str, MDL_SHARED)|SIGABRT|close_thread_table|mysql_create_like_table|Sql_cmd_create_table_like::execute|mysql_execute_command
      CS  12.1   opt  100625  6a2afb42ba86188ccda0972f9c2df363f34e10a0  No bug found                  
      ES  10.5   dbg  060625  ec7bc4f84e490b25f52db7422a1e0e8bbea72fb1  No bug found                  
      ES  10.5   opt  060625  ec7bc4f84e490b25f52db7422a1e0e8bbea72fb1  No bug found                  
      ES  10.6   dbg  060625  8541ea1e4c2fa15789dd162f6ba4b32681f74e61  No bug found                  
      ES  10.6   opt  060625  8541ea1e4c2fa15789dd162f6ba4b32681f74e61  No bug found                  
      ES  11.4   dbg  060625  1c8b2d3059f5ccb67c042868baca3ee269c6eca7  No bug found                  
      ES  11.4   opt  060625  1c8b2d3059f5ccb67c042868baca3ee269c6eca7  No bug found                  
      MS  5.5    dbg  070123  bac287c315b1792e7ae33f91add6a60292f9bae8  No bug found                  
      MS  5.5    opt  070123  bac287c315b1792e7ae33f91add6a60292f9bae8  No bug found                  
      MS  5.6    dbg  070123  dab95781a1244104d6b87020ac2fc4d190ba2946  No bug found                  
      MS  5.6    opt  070123  dab95781a1244104d6b87020ac2fc4d190ba2946  No bug found                  
      MS  5.7    dbg  070525  f7680e98b6bbe3500399fbad465d08a6b75d7a5c  No bug found                  
      MS  5.7    opt  070525  f7680e98b6bbe3500399fbad465d08a6b75d7a5c  No bug found                  
      MS  8.0    dbg  060224  49ef33f7edadef3ae04665e73d1babd40179a4f1  No bug found                  
      MS  8.0    opt  060224  49ef33f7edadef3ae04665e73d1babd40179a4f1  No bug found                  
      MS  9.1    dbg  211024  61a3a1d8ef15512396b4c2af46e922a19bf2b174  No bug found                  
      MS  9.1    opt  211024  61a3a1d8ef15512396b4c2af46e922a19bf2b174  No bug found                  
      

      Without TEMPORARY:

      CS 12.0.1 f1102da37a3dcdc8b92e0205f0a8bd878704b168 (Debug) Build 06/06/2025

      12.0.1-dbg>CREATE TABLE t LIKE information_schema.processlist;
      ERROR 1050 (42S01): Table 't' already exists
      

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.