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

wait_while_table_is_used() variation on MDEV-26805 stack in GTT branch

    XMLWordPrintable

Details

    • Not for Release Notes
    • Q4/2025 Server Development

    Description

      This MDEV-26805-similar testcase:

      CREATE TABLE t (a INT);
      SET max_session_mem_used=8192;
      --error ER_OPTION_PREVENTS_STATEMENT
      LOCK TABLES t READ;
      HANDLER t OPEN AS t;
      LOCK TABLES t WRITE;
      CREATE OR REPLACE SEQUENCE t COMMENT='';
      

      Will crash in trunk 12.2 builds with these leading stack frames:

      CS 12.2.0 8d08350dd3cac91df23a7dfbde23c276d7c7cd2b (Optimized, Clang 21.1.3-20250923) Build 16/10/2025

      #0  wait_while_table_is_used (thd=thd@entry=0x79e35c000c68, table=0x0, function=function@entry=HA_EXTRA_NOT_USED)at /test/12.2_opt/sql/sql_base.cc:1486
      #1  0x000063a59f352687 in mysql_rm_table_no_locks (thd=thd@entry=0x79e35c000c68, tables=tables@entry=0x79e35c0177c0, current_db=current_db@entry=0x79e35c000d08, ddl_log_state=0x79e48ada6e80, ddl_log_state@entry=0x0, if_exists=<optimized out>, drop_temporary=false, drop_view=<optimized out>, drop_sequence=<optimized out>, dont_log_query=<optimized out>, dont_free_locks=<optimized out>)at /test/12.2_opt/sql/sql_table.cc:1684
      #2  0x000063a59f357a86 in mysql_create_table_no_lock (thd=thd@entry=0x79e35c000c68, ddl_log_state_create=ddl_log_state_create@entry=0x79e48ada78d0, ddl_log_state_rm=ddl_log_state_rm@entry=0x79e48ada78f0, create_info=create_info@entry=0x79e48ada7ba0, alter_info=alter_info@entry=0x79e48ada7a28, is_trans=is_trans@entry=0x79e48ada7957, create_table_mode=0, table_list=0x79e35c0177c0) at /test/12.2_opt/sql/sql_table.cc:5078
      #3  0x000063a59f3691b6 in mysql_create_table (thd=thd@entry=0x79e35c000c68, create_table=create_table@entry=0x79e35c0177c0, create_info=create_info@entry=0x79e48ada7ba0, alter_info=alter_info@entry=0x79e48ada7a28)at /test/12.2_opt/sql/sql_table.cc:5294
      

      Versus the feature branch:

      MDEV-35915-8 CS 12.2.0 c7ea08421d34fa7d45e27919a869ade968bd88c4 (Optimized, Clang 21.1.3-20250923) Build 20/10/2025

      #0  wait_while_table_is_used (thd=thd@entry=0x7ba1c8000c68, table=0x0, function=function@entry=HA_EXTRA_NOT_USED, lock_wait_timeout=86400)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_base.cc:1497
      #1  0x00005a0a16306526 in wait_while_table_is_used (thd=0x7ba1c8000c68, table=0x0, table@entry=0x7ba1c8000c68, function=HA_EXTRA_NOT_USED)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_base.h:247
      #2  mysql_rm_table_no_locks (thd=thd@entry=0x7ba1c8000c68, tables=tables@entry=0x7ba1c80177a0, current_db=current_db@entry=0x7ba1c8000d08, ddl_log_state=0x7ba2f41b1ed0, ddl_log_state@entry=0x0, if_exists=<optimized out>, drop_temporary=false, drop_view=<optimized out>, drop_sequence=<optimized out>, dont_log_query=<optimized out>, dont_free_locks=<optimized out>)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_table.cc:1694
      #3  0x00005a0a1630bad6 in mysql_create_table_no_lock (thd=thd@entry=0x7ba1c8000c68, ddl_log_state_create=ddl_log_state_create@entry=0x7ba2f41b2930, ddl_log_state_rm=ddl_log_state_rm@entry=0x7ba2f41b2950, create_info=create_info@entry=0x7ba2f41b2ba0, alter_info=alter_info@entry=0x7ba2f41b2a28, is_trans=is_trans@entry=0x7ba2f41b29a7, create_table_mode=0, table_list=0x7ba1c80177a0)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_table.cc:5145
      #4  0x00005a0a1631dcd8 in mysql_create_table (thd=thd@entry=0x7ba1c8000c68, create_table=create_table@entry=0x7ba1c80177a0, create_info=create_info@entry=0x7ba2f41b2ba0, alter_info=alter_info@entry=0x7ba2f41b2a28)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_table.cc:5365
      

      Note how in the feature tree the wait_while_table_is_used frame is called twice before resulting in the same remainder stack.
      The same issue is present in debug builds.

      Especially as we have other GTT HANDLER/LOCK TABLES issues open, please confirm this is correct and as expected.
      If so, it's fine to close this bug, and I will add the occurence to MDEV-26805.

      Attachments

        Issue Links

          Activity

            People

              nikitamalyavin Nikita Malyavin
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: