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

SIGSEGV in handler::update_global_table_stats in close_thread_table()

    XMLWordPrintable

Details

    Description

      SET sql_mode='';
      CREATE TABLE t(c INT);
      HANDLER t OPEN h;
      INSERT INTO t VALUES();
      SET GLOBAL userstat=1;
      HANDLER h READ FIRST;
      CREATE TABLE t(c INT);
      

      Leads to:

      11.6.1 05fe3f1c186a221c4455b4d83a9d59f09f2dfadb (Optimized)

      Core was generated by `/test/MD130824-mariadb-11.6.1-linux-x86_64-opt/bin/mariadbd --no-defaults --max'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x0000561ee6e5c3a2 in handler::update_global_table_stats (this=this@entry=0x1462e4022140) at /test/11.6_opt/sql/handler.cc:6109
       
      warning: 6109	/test/11.6_opt/sql/handler.cc: No such file or directory
      [Current thread is 1 (LWP 318661)]
      (gdb) bt
      #0  0x0000561ee6e5c3a2 in handler::update_global_table_stats (this=this@entry=0x1462e4022140) at /test/11.6_opt/sql/handler.cc:6109
      #1  0x0000561ee6b3d632 in close_thread_table (thd=0x1462e4000c68, table_ptr=0x14633ff474e8) at /test/11.6_opt/sql/sql_base.cc:1016
      #2  0x0000561ee6b75448 in mysql_ha_close_table (handler=0x1462e40236e0)at /test/11.6_opt/sql/sql_handler.cc:221
      #3  0x0000561ee6b7729a in mysql_ha_rm_tables (thd=thd@entry=0x1462e4000c68, tables=<optimized out>) at /test/11.6_opt/sql/sql_handler.cc:1119
      #4  0x0000561ee6bb9c8f in mysql_execute_command (thd=thd@entry=0x1462e4000c68, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)at /test/11.6_opt/sql/sql_parse.cc:3807
      #5  0x0000561ee6bbec56 in mysql_parse (thd=0x1462e4000c68, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /test/11.6_opt/sql/sql_parse.cc:7869
      #6  0x0000561ee6bc0e75 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x1462e4000c68, packet=packet@entry=0x1462e4008869 "CREATE TABLE t(c INT)", packet_length=packet_length@entry=21, blocking=blocking@entry=true)at /test/11.6_opt/sql/sql_parse.cc:1991
      #7  0x0000561ee6bc3443 in do_command (thd=0x1462e4000c68, blocking=blocking@entry=true) at /test/11.6_opt/sql/sql_parse.cc:1405
      #8  0x0000561ee6cf446f in do_handle_one_connection (connect=<optimized out>, connect@entry=0x561ee9667618, put_in_cache=put_in_cache@entry=true)at /test/11.6_opt/sql/sql_connect.cc:1448
      #9  0x0000561ee6cf47cd in handle_one_connection (arg=arg@entry=0x561ee9667618)at /test/11.6_opt/sql/sql_connect.cc:1350
      #10 0x0000561ee70c1d2d in pfs_spawn_thread (arg=0x561ee968db98)at /test/11.6_opt/storage/perfschema/pfs.cc:2198
      #11 0x000014634509ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #12 0x0000146345129c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      11.6.1 05fe3f1c186a221c4455b4d83a9d59f09f2dfadb (Debug)

      Core was generated by `/test/MD130824-mariadb-11.6.1-linux-x86_64-dbg/bin/mariadbd --defaults-group-su'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x0000563d5656b464 in handler::update_global_table_stats (this=this@entry=0x14e3b0205680) at /test/11.6_dbg/sql/handler.cc:6109
       
      warning: 6109	/test/11.6_dbg/sql/handler.cc: No such file or directory
      [Current thread is 1 (LWP 4061382)]
      (gdb) bt
      #0  0x0000563d5656b464 in handler::update_global_table_stats (this=this@entry=0x14e3b0205680) at /test/11.6_dbg/sql/handler.cc:6109
      #1  0x0000563d561b2bb7 in close_thread_table (thd=thd@entry=0x14e3b0000d58, table_ptr=table_ptr@entry=0x14e3d013db50)at /test/11.6_dbg/sql/sql_base.cc:1016
      #2  0x0000563d561f41f2 in mysql_ha_close_table (handler=handler@entry=0x14e3b003b0d0)at /test/11.6_dbg/sql/sql_handler.cc:221
      #3  0x0000563d561f6e69 in mysql_ha_rm_tables (thd=thd@entry=0x14e3b0000d58, tables=<optimized out>) at /test/11.6_dbg/sql/sql_handler.cc:1119
      #4  0x0000563d562407d7 in mysql_execute_command (thd=thd@entry=0x14e3b0000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)at /test/11.6_dbg/sql/sql_parse.cc:3807
      #5  0x0000563d562470df in mysql_parse (thd=thd@entry=0x14e3b0000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14e3d013e250)at /test/11.6_dbg/sql/sql_parse.cc:7869
      #6  0x0000563d56249466 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14e3b0000d58, packet=packet@entry=0x14e3b01004e9 "CREATE TABLE t(c INT)", packet_length=packet_length@entry=21, blocking=blocking@entry=true)at /test/11.6_dbg/sql/sql_class.h:256
      #7  0x0000563d5624b88e in do_command (thd=0x14e3b0000d58, blocking=blocking@entry=true) at /test/11.6_dbg/sql/sql_parse.cc:1405
      #8  0x0000563d563bcead in do_handle_one_connection (connect=<optimized out>, connect@entry=0x563d592d8508, put_in_cache=put_in_cache@entry=true)at /test/11.6_dbg/sql/sql_connect.cc:1448
      #9  0x0000563d563bd1ae in handle_one_connection (arg=arg@entry=0x563d592d8508)at /test/11.6_dbg/sql/sql_connect.cc:1350
      #10 0x0000563d56820039 in pfs_spawn_thread (arg=0x563d59257ff8)at /test/11.6_dbg/storage/perfschema/pfs.cc:2198
      #11 0x000014e3d5e9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #12 0x000014e3d5f29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Git bisecting found this commit:

      commit ecc7961140968b3a9d464b65786bb3a3ca92bb42
      Author: Monty <monty@mariadb.org>
      Date:   Thu Jul 11 14:52:23 2024 +0300
       
          MDEV-34571 Add page accessed and pages read from disk to table_stats
       
          Trivial batch, using the handler statistics already collected for
          the slow query log.
       
          The reason for the changes in test cases was mainly to change to use
          select TABLE_SCHEMA ... from information_schema.table_statistics instead
          of 'show table_statistics' to avoid future changes to test results
          if we add more columns to table_statistics.
      

      Testcase is both CLI and MTR compatible.

      Attachments

        Issue Links

          Activity

            People

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