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

Server crash in MDL_ticket::has_stronger_or_equal_type or Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_SHARED)' failed in mysql_rm_table_no_locks

Details

    Description

      CREATE TABLE t1 (a INT);
      CREATE TEMPORARY TABLE tmp (b INT);
      LOCK TABLE t1 READ;
      --error ER_UNKNOWN_SEQUENCES
      DROP SEQUENCE tmp;
       
      # Cleanup
      UNLOCK TABLES;
      DROP TABLE t1;
      

      10.3 a2335b79

      mysqld: /data/src/10.3/sql/sql_table.cc:2395: int mysql_rm_table_no_locks(THD*, TABLE_LIST*, bool, bool, bool, bool, bool, bool): Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_SHARED)' failed.
      190417 19:02:21 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f1437b17ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x0000562c267cde8c in mysql_rm_table_no_locks (thd=0x7f1420000b00, tables=0x7f1420014db8, if_exists=false, drop_temporary=false, drop_view=false, drop_sequence=true, dont_log_query=false, dont_free_locks=false) at /data/src/10.3/sql/sql_table.cc:2393
      #9  0x0000562c267cd494 in mysql_rm_table (thd=0x7f1420000b00, tables=0x7f1420014db8, if_exists=false, drop_temporary=false, drop_sequence=true) at /data/src/10.3/sql/sql_table.cc:2124
      #10 0x0000562c26706f53 in mysql_execute_command (thd=0x7f1420000b00) at /data/src/10.3/sql/sql_parse.cc:5055
      #11 0x0000562c26710781 in mysql_parse (thd=0x7f1420000b00, rawbuf=0x7f1420014ce8 "DROP SEQUENCE tmp", length=17, parser_state=0x7f1431cbe5f0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8091
      #12 0x0000562c266fda50 in dispatch_command (command=COM_QUERY, thd=0x7f1420000b00, packet=0x7f142000b1f1 "DROP SEQUENCE tmp", packet_length=17, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1857
      #13 0x0000562c266fc43a in do_command (thd=0x7f1420000b00) at /data/src/10.3/sql/sql_parse.cc:1403
      #14 0x0000562c2686503d in do_handle_one_connection (connect=0x562c2909f0b0) at /data/src/10.3/sql/sql_connect.cc:1402
      #15 0x0000562c26864dc1 in handle_one_connection (arg=0x562c2909f0b0) at /data/src/10.3/sql/sql_connect.cc:1308
      #16 0x0000562c26d016a3 in pfs_spawn_thread (arg=0x562c28fe3f50) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #17 0x00007f1439c0c494 in start_thread (arg=0x7f1431cbf700) at pthread_create.c:333
      #18 0x00007f1437bd493f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      No obvious problems on a non-debug build with the test case above, but here is another one which does cause a crash on a non-debug build (and the same assertion failure on a debug build):

      CREATE TABLE t (a INT);
      CREATE TEMPORARY TABLE s (f INT);
      CREATE SEQUENCE s;
      LOCK TABLE t WRITE;
      DROP SEQUENCE s;
       
      # Cleanup
      UNLOCK TABLES;
      DROP TABLE t;
      

      10.3 a2335b79 non-debug

      #2  <signal handler called>
      #3  0x000055ca45f79e0c in MDL_ticket::has_stronger_or_equal_type (this=this@entry=0x0, type=type@entry=MDL_EXCLUSIVE) at /data/src/10.3/sql/mdl.cc:1720
      #4  0x000055ca45f7bd60 in MDL_context::upgrade_shared_lock (this=this@entry=0x7f3670000ac8, mdl_ticket=0x0, new_type=new_type@entry=MDL_EXCLUSIVE, lock_wait_timeout=86400) at /data/src/10.3/sql/mdl.cc:2330
      #5  0x000055ca45e3ede5 in wait_while_table_is_used (thd=thd@entry=0x7f36700009a8, table=0x7f367006bf78, function=function@entry=HA_EXTRA_NOT_USED) at /data/src/10.3/sql/sql_base.cc:1246
      #6  0x000055ca45f1aeb7 in mysql_rm_table_no_locks (thd=0x7f36700009a8, tables=<optimized out>, if_exists=<optimized out>, drop_temporary=<optimized out>, drop_view=<optimized out>, drop_sequence=<optimized out>, dont_log_query=false, dont_free_locks=false) at /data/src/10.3/sql/sql_table.cc:2487
      #7  0x000055ca45f1c055 in mysql_rm_table (thd=0x7f36700009a8, tables=0x7f3670011758, if_exists=false, drop_temporary=3, drop_sequence=false) at /data/src/10.3/sql/sql_table.cc:2124
      #8  0x000055ca45e992fb in mysql_execute_command (thd=0x7f36700009a8) at /data/src/10.3/sql/sql_parse.cc:5055
      #9  0x000055ca45e9d8e1 in mysql_parse (thd=0x7f36700009a8, rawbuf=<optimized out>, length=15, parser_state=0x7f368139f630, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.3/sql/sql_parse.cc:8091
      #10 0x000055ca45ea0028 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f36700009a8, packet=packet@entry=0x7f3670009329 "DROP SEQUENCE s", packet_length=packet_length@entry=15, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.3/sql/sql_parse.cc:1857
      #11 0x000055ca45ea09e0 in do_command (thd=0x7f36700009a8) at /data/src/10.3/sql/sql_parse.cc:1403
      #12 0x000055ca45f73994 in do_handle_one_connection (connect=connect@entry=0x55ca49089f08) at /data/src/10.3/sql/sql_connect.cc:1402
      #13 0x000055ca45f73b34 in handle_one_connection (arg=arg@entry=0x55ca49089f08) at /data/src/10.3/sql/sql_connect.cc:1308
      #14 0x000055ca46258614 in pfs_spawn_thread (arg=0x55ca4908a168) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #15 0x00007f36892ef494 in start_thread (arg=0x7f36813a0700) at pthread_create.c:333
      #16 0x00007f36872b793f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Attachments

        Issue Links

          Activity

            I suppose this failure has the same root cause – at least whenever I try to reproduce it, I get one of those in the description instead.

            #5  <signal handler called>
            #6  0x000055bb000bb065 in I_P_List<MDL_ticket, I_P_List_adapter<MDL_ticket, &MDL_ticket::next_in_lock, &MDL_ticket::prev_in_lock>, I_P_List_null_counter, I_P_List_fast_push_back<MDL_ticket> >::remove (this=0x55bb02a03de8, a=0
            x7fa84c228c50) at /home/elenst/src/10.3-enterprise/sql/sql_plist.h:126
            #7  0x000055bb000b68b7 in MDL_lock::Ticket_list::remove_ticket (this=0x55bb02a03de8, ticket=0x7fa84c228c50) at /home/elenst/src/10.3-enterprise/sql/mdl.cc:1278
            #8  0x000055bb000b6e68 in MDL_lock::remove_ticket (this=0x55bb02a03be0, pins=0x55bb02a25450, list=&MDL_lock::m_granted, ticket=0x7fa84c228c50) at /home/elenst/src/10.3-enterprise/sql/mdl.cc:1826
            #9  0x000055bb000b8eda in MDL_context::release_lock (this=0x7fa84c000c20, duration=MDL_STATEMENT, ticket=0x7fa84c228c50) at /home/elenst/src/10.3-enterprise/sql/mdl.cc:2832
            #10 0x000055bb000b90b3 in MDL_context::release_locks_stored_before (this=0x7fa84c000c20, duration=MDL_STATEMENT, sentinel=0x0) at /home/elenst/src/10.3-enterprise/sql/mdl.cc:2882
            #11 0x000055bb000b97bc in MDL_context::release_transactional_locks (this=0x7fa84c000c20) at /home/elenst/src/10.3-enterprise/sql/mdl.cc:3063
            #12 0x000055bafff3eaad in mysql_execute_command (thd=0x7fa84c000b00) at /home/elenst/src/10.3-enterprise/sql/sql_parse.cc:6192
            #13 0x000055bafff63388 in Prepared_statement::execute (this=0x7fa84c4b9550, expanded_query=0x7fa8b82f0240, open_cursor=false) at /home/elenst/src/10.3-enterprise/sql/sql_prepare.cc:4900
            #14 0x000055bafff61572 in Prepared_statement::execute_loop (this=0x7fa84c4b9550, expanded_query=0x7fa8b82f0240, open_cursor=false, packet=0x7fa84c008d3a "", packet_end=0x7fa84c008d3a "") at /home/elenst/src/10.3-enterprise/sq
            l/sql_prepare.cc:4312
            #15 0x000055bafff5ebee in mysql_stmt_execute_common (thd=0x7fa84c000b00, stmt_id=4148, packet=0x7fa84c008d3a "", packet_end=0x7fa84c008d3a "", cursor_flags=0, bulk_op=false, read_types=false) at /home/elenst/src/10.3-enterpri
            se/sql/sql_prepare.cc:3283
            #16 0x000055bafff5e710 in mysqld_stmt_execute (thd=0x7fa84c000b00, packet_arg=0x7fa84c008d31 "4\020", packet_length=9) at /home/elenst/src/10.3-enterprise/sql/sql_prepare.cc:3174
            #17 0x000055bafff2fe9c in dispatch_command (command=COM_STMT_EXECUTE, thd=0x7fa84c000b00, packet=0x7fa84c008d31 "4\020", packet_length=9, is_com_multi=false, is_next_command=false) at /home/elenst/src/10.3-enterprise/sql/sql_parse.cc:1799
            #18 0x000055bafff2eb6d in do_command (thd=0x7fa84c000b00) at /home/elenst/src/10.3-enterprise/sql/sql_parse.cc:1403
            #19 0x000055bb000ac733 in do_handle_one_connection (connect=0x55bb0381a500) at /home/elenst/src/10.3-enterprise/sql/sql_connect.cc:1403
            #20 0x000055bb000ac475 in handle_one_connection (arg=0x55bb0381a500) at /home/elenst/src/10.3-enterprise/sql/sql_connect.cc:1308
            #21 0x00007fa8d6c4cdd5 in start_thread () from /lib64/libpthread.so.0
            #22 0x00007fa8d4830ead in clone () from /lib64/libc.so.6
            

            elenst Elena Stepanova added a comment - I suppose this failure has the same root cause – at least whenever I try to reproduce it, I get one of those in the description instead. #5 <signal handler called> #6 0x000055bb000bb065 in I_P_List<MDL_ticket, I_P_List_adapter<MDL_ticket, &MDL_ticket::next_in_lock, &MDL_ticket::prev_in_lock>, I_P_List_null_counter, I_P_List_fast_push_back<MDL_ticket> >::remove (this=0x55bb02a03de8, a=0 x7fa84c228c50) at /home/elenst/src/10.3-enterprise/sql/sql_plist.h:126 #7 0x000055bb000b68b7 in MDL_lock::Ticket_list::remove_ticket (this=0x55bb02a03de8, ticket=0x7fa84c228c50) at /home/elenst/src/10.3-enterprise/sql/mdl.cc:1278 #8 0x000055bb000b6e68 in MDL_lock::remove_ticket (this=0x55bb02a03be0, pins=0x55bb02a25450, list=&MDL_lock::m_granted, ticket=0x7fa84c228c50) at /home/elenst/src/10.3-enterprise/sql/mdl.cc:1826 #9 0x000055bb000b8eda in MDL_context::release_lock (this=0x7fa84c000c20, duration=MDL_STATEMENT, ticket=0x7fa84c228c50) at /home/elenst/src/10.3-enterprise/sql/mdl.cc:2832 #10 0x000055bb000b90b3 in MDL_context::release_locks_stored_before (this=0x7fa84c000c20, duration=MDL_STATEMENT, sentinel=0x0) at /home/elenst/src/10.3-enterprise/sql/mdl.cc:2882 #11 0x000055bb000b97bc in MDL_context::release_transactional_locks (this=0x7fa84c000c20) at /home/elenst/src/10.3-enterprise/sql/mdl.cc:3063 #12 0x000055bafff3eaad in mysql_execute_command (thd=0x7fa84c000b00) at /home/elenst/src/10.3-enterprise/sql/sql_parse.cc:6192 #13 0x000055bafff63388 in Prepared_statement::execute (this=0x7fa84c4b9550, expanded_query=0x7fa8b82f0240, open_cursor=false) at /home/elenst/src/10.3-enterprise/sql/sql_prepare.cc:4900 #14 0x000055bafff61572 in Prepared_statement::execute_loop (this=0x7fa84c4b9550, expanded_query=0x7fa8b82f0240, open_cursor=false, packet=0x7fa84c008d3a "", packet_end=0x7fa84c008d3a "") at /home/elenst/src/10.3-enterprise/sq l/sql_prepare.cc:4312 #15 0x000055bafff5ebee in mysql_stmt_execute_common (thd=0x7fa84c000b00, stmt_id=4148, packet=0x7fa84c008d3a "", packet_end=0x7fa84c008d3a "", cursor_flags=0, bulk_op=false, read_types=false) at /home/elenst/src/10.3-enterpri se/sql/sql_prepare.cc:3283 #16 0x000055bafff5e710 in mysqld_stmt_execute (thd=0x7fa84c000b00, packet_arg=0x7fa84c008d31 "4\020", packet_length=9) at /home/elenst/src/10.3-enterprise/sql/sql_prepare.cc:3174 #17 0x000055bafff2fe9c in dispatch_command (command=COM_STMT_EXECUTE, thd=0x7fa84c000b00, packet=0x7fa84c008d31 "4\020", packet_length=9, is_com_multi=false, is_next_command=false) at /home/elenst/src/10.3-enterprise/sql/sql_parse.cc:1799 #18 0x000055bafff2eb6d in do_command (thd=0x7fa84c000b00) at /home/elenst/src/10.3-enterprise/sql/sql_parse.cc:1403 #19 0x000055bb000ac733 in do_handle_one_connection (connect=0x55bb0381a500) at /home/elenst/src/10.3-enterprise/sql/sql_connect.cc:1403 #20 0x000055bb000ac475 in handle_one_connection (arg=0x55bb0381a500) at /home/elenst/src/10.3-enterprise/sql/sql_connect.cc:1308 #21 0x00007fa8d6c4cdd5 in start_thread () from /lib64/libpthread.so.0 #22 0x00007fa8d4830ead in clone () from /lib64/libc.so.6

            commit 1ee4055c07ebf4212d8e49d44ea724645e3eaa7a (HEAD > bb-10.3MDEV-19273, origin/bb-10.3-MDEV-19273)
            Author: Oleksandr Byelkin <sanja@mariadb.com>
            Date: Sun Mar 22 11:33:53 2020 +0100

            MDEV-19273: Server crash in MDL_ticket::has_stronger_or_equal_type or Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_SHARED)' failed in mysql_rm_table_no_locks

            Do not check lock status if we already detected error.

            sanja Oleksandr Byelkin added a comment - commit 1ee4055c07ebf4212d8e49d44ea724645e3eaa7a (HEAD > bb-10.3 MDEV-19273 , origin/bb-10.3- MDEV-19273 ) Author: Oleksandr Byelkin <sanja@mariadb.com> Date: Sun Mar 22 11:33:53 2020 +0100 MDEV-19273 : Server crash in MDL_ticket::has_stronger_or_equal_type or Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_SHARED)' failed in mysql_rm_table_no_locks Do not check lock status if we already detected error.
            svoj Sergey Vojtovich added a comment - Review in https://github.com/MariaDB/server/commit/1ee4055c07ebf4212d8e49d44ea724645e3eaa7a

            svoj sorry for wasting your time but I did not asked you to review (it was not the patch I will push)

            sanja Oleksandr Byelkin added a comment - svoj sorry for wasting your time but I did not asked you to review (it was not the patch I will push)

            commit b47524123dfd494b0d6a453064267f067cca634d (HEAD > bb-10.3MDEV-19273, origin/bb-10.3-MDEV-19273)
            Author: Oleksandr Byelkin <sanja@mariadb.com>
            Date: Sun Mar 22 11:33:53 2020 +0100

            MDEV-19273: Server crash in MDL_ticket::has_stronger_or_equal_type or Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_SHARED)' failed in mysql_rm_table_no_locks

            Early report error in case of DROP SEQUENCE <non-sequence>

            Do not use error variable for other purposes except error.

            sanja Oleksandr Byelkin added a comment - commit b47524123dfd494b0d6a453064267f067cca634d (HEAD > bb-10.3 MDEV-19273 , origin/bb-10.3- MDEV-19273 ) Author: Oleksandr Byelkin <sanja@mariadb.com> Date: Sun Mar 22 11:33:53 2020 +0100 MDEV-19273 : Server crash in MDL_ticket::has_stronger_or_equal_type or Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_SHARED)' failed in mysql_rm_table_no_locks Early report error in case of DROP SEQUENCE <non-sequence> Do not use error variable for other purposes except error.

            commit e9fc2400f3cc98a3fae743c42c0e8b9c1631c280 (HEAD > bb-10.3MDEV-19273, origin/bb-10.3-MDEV-19273)
            Author: Oleksandr Byelkin <sanja@mariadb.com>
            Date: Sun Mar 22 11:33:53 2020 +0100

            MDEV-19273: Server crash in MDL_ticket::has_stronger_or_equal_type or Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_SHARED)' failed in mysql_rm_table_no_locks

            Early report error in case of DROP SEQUENCE <non-sequence>

            Do not use error variable for other purposes except error.

            sanja Oleksandr Byelkin added a comment - commit e9fc2400f3cc98a3fae743c42c0e8b9c1631c280 (HEAD > bb-10.3 MDEV-19273 , origin/bb-10.3- MDEV-19273 ) Author: Oleksandr Byelkin <sanja@mariadb.com> Date: Sun Mar 22 11:33:53 2020 +0100 MDEV-19273 : Server crash in MDL_ticket::has_stronger_or_equal_type or Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_SHARED)' failed in mysql_rm_table_no_locks Early report error in case of DROP SEQUENCE <non-sequence> Do not use error variable for other purposes except error.

            MDEV-23205 Marked as duplicate of this one, slightly different testcase, please check against fix.

            Roel Roel Van de Paar added a comment - MDEV-23205 Marked as duplicate of this one, slightly different testcase, please check against fix.

            commit 174f1be545ee9381ddac9e774ebb091ac02104e7 (HEAD > bb-10.3MDEV-19273, origin/bb-10.3-MDEV-19273)
            Author: Oleksandr Byelkin <sanja@mariadb.com>
            Date: Sun Mar 22 11:33:53 2020 +0100

            MDEV-19273: Server crash in MDL_ticket::has_stronger_or_equal_type or Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_SHARED)' failed in mysql_rm_table_no_locks

            Early report error in case of DROP SEQUENCE <non-sequence>

            Do not use error variable for other purposes except error.

            sanja Oleksandr Byelkin added a comment - commit 174f1be545ee9381ddac9e774ebb091ac02104e7 (HEAD > bb-10.3 MDEV-19273 , origin/bb-10.3- MDEV-19273 ) Author: Oleksandr Byelkin <sanja@mariadb.com> Date: Sun Mar 22 11:33:53 2020 +0100 MDEV-19273 : Server crash in MDL_ticket::has_stronger_or_equal_type or Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_SHARED)' failed in mysql_rm_table_no_locks Early report error in case of DROP SEQUENCE <non-sequence> Do not use error variable for other purposes except error.

            commit 026d5fff89d2e690bfd5b4cdc0650eff5e5ffc42 (HEAD > bb-10.3MDEV-19273, origin/bb-10.3-MDEV-19273)
            Author: Oleksandr Byelkin <sanja@mariadb.com>
            Date: Sun Mar 22 11:33:53 2020 +0100

            MDEV-19273: Server crash in MDL_ticket::has_stronger_or_equal_type or Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_SHARED)' failed in mysql_rm_table_no_locks

            Early report error in case of DROP SEQUENCE <non-sequence>

            Do not use error variable for other purposes except error.

            sanja Oleksandr Byelkin added a comment - commit 026d5fff89d2e690bfd5b4cdc0650eff5e5ffc42 (HEAD > bb-10.3 MDEV-19273 , origin/bb-10.3- MDEV-19273 ) Author: Oleksandr Byelkin <sanja@mariadb.com> Date: Sun Mar 22 11:33:53 2020 +0100 MDEV-19273 : Server crash in MDL_ticket::has_stronger_or_equal_type or Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_SHARED)' failed in mysql_rm_table_no_locks Early report error in case of DROP SEQUENCE <non-sequence> Do not use error variable for other purposes except error.

            if it is a new issue why it is in the old bug report?

            sanja Oleksandr Byelkin added a comment - if it is a new issue why it is in the old bug report?

            Related bug report moved to MDEV-24382. Thank you

            Roel Roel Van de Paar added a comment - Related bug report moved to MDEV-24382 . Thank you

            People

              sanja Oleksandr Byelkin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              7 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.