Uploaded image for project: 'Percona Server'
  1. Percona Server
  2. PS-4977

[PS8QA] Flushing the table with read lock could lead to a server crash if PS_metadata locks is queried

    Details

    • Type: Bug
    • Status: Done
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 8.0, Not 5.5, Not 5.6, Not 5.7
    • Fix Version/s: 8.0.13-3
    • Component/s: None
    • Labels:

      Description

      sql:

      # mysqld options required for replay: --plugin-load-add=RocksDB=ha_rocksdb.so
      CREATE DATABASE test;
      USE test;
      CREATE TABLE t0(a INT)ENGINE=RocksDB;
      flush TABLE t0 with read lock;
      select count(*)from performance_schema.metadata_locks;
      

      gdb:

      (gdb) bt
      +bt
      #0  0x00007fdcb8d76a01 in __pthread_kill (threadid=<optimized out>, signo=11) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
      #1  0x0000000003e11c99 in my_write_core (sig=11) at /home/hrvoje/worktable/PS-8.0.12-2_dbg/mysys/stacktrace.cc:278
      #2  0x0000000002e802cb in handle_fatal_signal (sig=11) at /home/hrvoje/worktable/PS-8.0.12-2_dbg/sql/signal_handler.cc:254
      #3  <signal handler called>
      #4  __memcpy_ssse3_back () at ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S:2829
      #5  0x0000000003f740cb in PFS_column_row::make_row (this=0x7fdc53814c90, mdl=0x7fdc813b4018) at /home/hrvoje/worktable/PS-8.0.12-2_dbg/storage/perfschema/table_helper.cc:783
      #6  0x0000000003f65174 in table_metadata_locks::make_row (this=0x7fdc53814c00, pfs=0x7fdc813b4000) at /home/hrvoje/worktable/PS-8.0.12-2_dbg/storage/perfschema/table_md_locks.cc:250
      #7  0x0000000003f64dbd in table_metadata_locks::rnd_next (this=0x7fdc53814c00) at /home/hrvoje/worktable/PS-8.0.12-2_dbg/storage/perfschema/table_md_locks.cc:170
      #8  0x0000000003ef1dc9 in ha_perfschema::rnd_next (this=0x7fdc53a3e028, buf=0x7fdc538dda28 "") at /home/hrvoje/worktable/PS-8.0.12-2_dbg/storage/perfschema/ha_perfschema.cc:1614
      #9  0x0000000002987ec3 in handler::ha_rnd_next (this=0x7fdc53a3e028, buf=0x7fdc538dda28 "") at /home/hrvoje/worktable/PS-8.0.12-2_dbg/sql/handler.cc:2947
      #10 0x0000000002bb545d in rr_sequential (info=0x7fdc53861430) at /home/hrvoje/worktable/PS-8.0.12-2_dbg/sql/records.cc:523
      #11 0x0000000002c70275 in sub_select (join=0x7fdc539cca38, qep_tab=0x7fdc538613e0, end_of_records=false) at /home/hrvoje/worktable/PS-8.0.12-2_dbg/sql/sql_executor.cc:1514
      #12 0x0000000002c6fa08 in do_select (join=0x7fdc539cca38) at /home/hrvoje/worktable/PS-8.0.12-2_dbg/sql/sql_executor.cc:1171
      #13 0x0000000002c6cdf6 in JOIN::exec (this=0x7fdc539cca38) at /home/hrvoje/worktable/PS-8.0.12-2_dbg/sql/sql_executor.cc:294
      #14 0x0000000002d3b8d9 in Sql_cmd_dml::execute_inner (this=0x7fdc539cb510, thd=0x7fdc5381a000) at /home/hrvoje/worktable/PS-8.0.12-2_dbg/sql/sql_select.cc:652
      #15 0x0000000002d3b38c in Sql_cmd_dml::execute (this=0x7fdc539cb510, thd=0x7fdc5381a000) at /home/hrvoje/worktable/PS-8.0.12-2_dbg/sql/sql_select.cc:555
      #16 0x0000000002ce1da0 in mysql_execute_command (thd=0x7fdc5381a000, first_level=true) at /home/hrvoje/worktable/PS-8.0.12-2_dbg/sql/sql_parse.cc:4421
      #17 0x0000000002ce4005 in mysql_parse (thd=0x7fdc5381a000, parser_state=0x7fdc9f7fd160, update_userstat=false) at /home/hrvoje/worktable/PS-8.0.12-2_dbg/sql/sql_parse.cc:5143
      #18 0x0000000002cd9ca4 in dispatch_command (thd=0x7fdc5381a000, com_data=0x7fdc9f7fdb20, command=COM_QUERY) at /home/hrvoje/worktable/PS-8.0.12-2_dbg/sql/sql_parse.cc:1654
      #19 0x0000000002cd852e in do_command (thd=0x7fdc5381a000) at /home/hrvoje/worktable/PS-8.0.12-2_dbg/sql/sql_parse.cc:1262
      #20 0x0000000002e6d6c8 in handle_connection (arg=0x7fdc6432e1c0) at /home/hrvoje/worktable/PS-8.0.12-2_dbg/sql/conn_handler/connection_handler_per_thread.cc:317
      #21 0x0000000003ef5671 in pfs_spawn_thread (arg=0x7fdc642fbf20) at /home/hrvoje/worktable/PS-8.0.12-2_dbg/storage/perfschema/pfs.cc:2836
      #22 0x00007fdcb8d71e25 in start_thread (arg=0x7fdc9f7fe700) at pthread_create.c:308
      #23 0x00007fdcb6f42bad in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113
      

      I'm able to reproduce this on a release build for RM-381:

      Server version: 8.0.12-2 Percona Server (GPL), Release '2', Revision 'ee0aa63'
      ...
      mysql> CREATE DATABASE test;
      Query OK, 1 row affected (0.01 sec)
      
      mysql> USE test;
      Database changed
      mysql> CREATE TABLE t0(a INT)ENGINE=RocksDB;
      Query OK, 0 rows affected (0.02 sec)
      
      mysql> flush TABLE t0 with read lock;
      Query OK, 0 rows affected (0.00 sec)
      
      mysql> select count(*)from performance_schema.metadata_locks;
      ERROR 2013 (HY000): Lost connection to MySQL server during query
      

        Smart Checklist

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  george.lorch George Lorch
                  Reporter:
                  hrvoje.matijakovic Hrvoje Matijakovic
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - Not Specified
                    Not Specified
                    Logged:
                    Time Spent - 3 hours, 22 minutes
                    3h 22m