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

SIGSEGV in MDL_context::release_lock on ALTER on locked GTT in low memory env

    XMLWordPrintable

Details

    • Not for Release Notes
    • Q4/2025 Server Maintenance

    Description

      SET max_session_mem_used=8192;
      CREATE GLOBAL TEMPORARY TABLE t (t TEXT);
      --error ER_OPTION_PREVENTS_STATEMENT
      INSERT t VALUES (0);
      LOCK TABLE t WRITE;
      ALTER TABLE t ADD z INT;
      

      Leads to:

      MDEV-35915-5 CS 12.2.0 5a344faeb0bab8520ad5c92be6fc1fc0a9c56d52 (Optimized, Clang 21.1.0-20250811) Build 16/09/2025

      Core was generated by `/test/MDEV-35915_5_MD160925-mariadb-12.2.0-linux-x86_64-opt/bin/mariadbd --no-d'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  MDL_context::release_lock (this=0x7c400c000e78, duration=<optimized out>, ticket=0x0) at /test/bb-12.2-nikita-global-tmp_opt/sql/mdl.cc:3486
       
      [Current thread is 1 (LWP 1349871)]
      (gdb) bt
      #0  MDL_context::release_lock (this=0x7c400c000e78, duration=<optimized out>, ticket=0x0) at /test/bb-12.2-nikita-global-tmp_opt/sql/mdl.cc:3486
      #1  0x00005f0ec7c25ff9 in THD::free_tmp_table_share (this=this@entry=0x7c400c000c68, share=share@entry=0x7c400c02c518, delete_table=<optimized out>)at /test/bb-12.2-nikita-global-tmp_opt/sql/temporary_tables.cc:1764
      #2  0x00005f0ec7c28725 in THD::drop_tmp_table_share (this=0x7c400c000c68, table=<optimized out>, share=0x7c400c02c518, delete_table=true)at /test/bb-12.2-nikita-global-tmp_opt/sql/temporary_tables.cc:820
      #3  0x00005f0ec7ab83a4 in mysql_alter_table (thd=thd@entry=0x7c400c000c68, new_db=new_db@entry=0x7c400c005990, new_name=new_name@entry=0x7c400c005e08, create_info=create_info@entry=0x7c40fc5fdba8, table_list=0x7c400c017758, recreate_info=recreate_info@entry=0x7c40fc5fd2f0, alter_info=0x7c40fc5fda30, order_num=0, order=0x0, ignore=<optimized out>, if_exists=<optimized out>)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_table.cc:12624
      #4  0x00005f0ec7b3f8bb in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x7c400c000c68)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_alter.cc:695
      #5  0x00005f0ec79e6b7c in mysql_execute_command (thd=thd@entry=0x7c400c000c68, is_called_from_prepared_stmt=false)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_parse.cc:5861
      #6  0x00005f0ec79e1e24 in mysql_parse (thd=thd@entry=0x7c400c000c68, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7c40fc5fe420)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_parse.cc:7894
      #7  0x00005f0ec79e05cd in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7c400c000c68, packet=packet@entry=0x7c400c0089f9 "ALTER TABLE t ADD z INT", packet_length=packet_length@entry=23, blocking=true)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_parse.cc:1882
      #8  0x00005f0ec79e22a1 in do_command (thd=thd@entry=0x7c400c000c68, blocking=true) at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_parse.cc:1421
      #9  0x00005f0ec7b384fd in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5f0ec9e64c78, put_in_cache=true)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_connect.cc:1414
      #10 0x00005f0ec7b382bf in handle_one_connection (arg=arg@entry=0x5f0ec9e64c78)at /test/bb-12.2-nikita-global-tmp_opt/sql/sql_connect.cc:1326
      #11 0x00005f0ec7cfcd59 in pfs_spawn_thread (arg=0x5f0ec9e14978)at /test/bb-12.2-nikita-global-tmp_opt/storage/perfschema/pfs.cc:2198
      #12 0x00007c40fe09ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #13 0x00007c40fe129c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      MDEV-35915-5 CS 12.2.0 5a344faeb0bab8520ad5c92be6fc1fc0a9c56d52 (Debug, Clang 21.1.0-20250811) Build 16/09/2025

      Core was generated by `/test/MDEV-35915_5_MD160925-mariadb-12.2.0-linux-x86_64-dbg/bin/mariadbd --no-d'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x00005b630d4090cc in MDL_context::release_lock (this=0x76ca28000f70, ticket=0xa5a5a5a5a5a5a5a5)at /test/bb-12.2-nikita-global-tmp_dbg/sql/mdl.cc:3513
       
      [Current thread is 1 (LWP 1369551)]
      (gdb) bt
      #0  0x00005b630d4090cc in MDL_context::release_lock (this=0x76ca28000f70, ticket=0xa5a5a5a5a5a5a5a5)at /test/bb-12.2-nikita-global-tmp_dbg/sql/mdl.cc:3513
      #1  0x00005b630d54a698 in THD::free_tmp_table_share (this=0x76ca28000d58, share=0x76ca2803ea58, delete_table=true)at /test/bb-12.2-nikita-global-tmp_dbg/sql/temporary_tables.cc:1764
      #2  0x00005b630d54cbb5 in THD::drop_tmp_table_share (this=0x76ca28000d58, table=0x76ca28041308, share=0x76ca2803ea58, delete_table=true)at /test/bb-12.2-nikita-global-tmp_dbg/sql/temporary_tables.cc:820
      #3  0x00005b630d54a7a5 in THD::drop_temporary_table (this=0x76ca28000d58, table=0x76ca28041308, is_trans=0x0, delete_table=true)at /test/bb-12.2-nikita-global-tmp_dbg/sql/temporary_tables.cc:770
      #4  0x00005b630d33a9cc in mysql_alter_table (thd=0x76ca28000d58, new_db=0x76ca28005a58, new_name=0x76ca28005ed0, create_info=0x76cb58b2ffc0, table_list=0x76ca28019f58, recreate_info=0x76cb58b2f6f0, alter_info=0x76cb58b2fe48, order_num=0, order=0x0, ignore=false, if_exists=false)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_table.cc:12624
      #5  0x00005b630d402c12 in Sql_cmd_alter_table::execute (this=0x76ca2801a7a8, thd=0x76ca28000d58)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_alter.cc:695
      #6  0x00005b630d212be5 in mysql_execute_command (thd=0x76ca28000d58, is_called_from_prepared_stmt=false)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_parse.cc:5861
      #7  0x00005b630d203ea8 in mysql_parse (thd=0x76ca28000d58, rawbuf=0x76ca28019e80 "ALTER TABLE t ADD z INT", length=23, parser_state=0x76cb58b31a10)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_parse.cc:7894
      #8  0x00005b630d201689 in dispatch_command (command=COM_QUERY, thd=0x76ca28000d58, packet=0x76ca2800b1f9 "ALTER TABLE t ADD z INT", packet_length=23, blocking=true)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_parse.cc:1882
      #9  0x00005b630d20492a in do_command (thd=0x76ca28000d58, blocking=true)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_parse.cc:1421
      #10 0x00005b630d3f71ce in do_handle_one_connection (connect=0x5b630ff0d368, put_in_cache=true)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_connect.cc:1414
      #11 0x00005b630d3f6fb1 in handle_one_connection (arg=0x5b630ff1e408)at /test/bb-12.2-nikita-global-tmp_dbg/sql/sql_connect.cc:1326
      #12 0x000076cb5bc9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #13 0x000076cb5bd29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      InnoDB and MyISAM both affected

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

                Git Integration

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