[MDEV-23205] Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, db.str, table_name.str, MDL_SHARED)' failed in mysql_rm_table_no_locks Created: 2020-07-18  Updated: 2020-07-27  Resolved: 2020-07-27

Status: Closed
Project: MariaDB Server
Component/s: Locking, Storage Engine - Sequence
Affects Version/s: 10.3, 10.4, 10.5
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Vladislav Vaintroub
Resolution: Duplicate Votes: 0
Labels: not-10.1, not-10.2

Issue Links:
Duplicate
duplicates MDEV-19273 Server crash in MDL_ticket::has_stron... Closed

 Description   

USE test;
CREATE TEMPORARY TABLE t (c INT);
LOCK TABLE t WRITE;
DROP SEQUENCE IF EXISTS t;

Leads to:

10.5.5 30e7a0a866dce530d8328c6d614e48d39a264f9b

mysqld: /test/10.5_dbg/sql/sql_table.cc:2396: 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, db.str, table_name.str, MDL_SHARED)' failed.

10.5.5 30e7a0a866dce530d8328c6d614e48d39a264f9b

Core was generated by `/test/MD140720-mariadb-10.5.5-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
[Current thread is 1 (Thread 0x1515df246700 (LWP 1424019))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000055676f2f74d7 in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
#2  0x000055676eab19ba in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00001515dd4dc8b1 in __GI_abort () at abort.c:79
#6  0x00001515dd4cc42a in __assert_fail_base (fmt=0x1515dd653a38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55676f490a20 "thd->mdl_context.is_lock_owner(MDL_key::TABLE, db.str, table_name.str, MDL_SHARED)", file=file@entry=0x55676f490208 "/test/10.5_dbg/sql/sql_table.cc", line=line@entry=2396, function=function@entry=0x55676f493160 <mysql_rm_table_no_locks(THD*, TABLE_LIST*, bool, bool, bool, bool, bool, bool)::__PRETTY_FUNCTION__> "int mysql_rm_table_no_locks(THD*, TABLE_LIST*, bool, bool, bool, bool, bool, bool)") at assert.c:92
#7  0x00001515dd4cc4a2 in __GI___assert_fail (assertion=assertion@entry=0x55676f490a20 "thd->mdl_context.is_lock_owner(MDL_key::TABLE, db.str, table_name.str, MDL_SHARED)", file=file@entry=0x55676f490208 "/test/10.5_dbg/sql/sql_table.cc", line=line@entry=2396, function=function@entry=0x55676f493160 <mysql_rm_table_no_locks(THD*, TABLE_LIST*, bool, bool, bool, bool, bool, bool)::__PRETTY_FUNCTION__> "int mysql_rm_table_no_locks(THD*, TABLE_LIST*, bool, bool, bool, bool, bool, bool)") at assert.c:101
#8  0x000055676e8c881a in mysql_rm_table_no_locks (thd=thd@entry=0x1515bac15088, tables=tables@entry=0x1515bac74170, if_exists=if_exists@entry=true, drop_temporary=drop_temporary@entry=false, drop_view=drop_view@entry=false, drop_sequence=drop_sequence@entry=true, dont_log_query=false, dont_free_locks=false) at /test/10.5_dbg/sql/sql_table.cc:2395
#9  0x000055676e8caa03 in mysql_rm_table (thd=thd@entry=0x1515bac15088, tables=tables@entry=0x1515bac74170, if_exists=<optimized out>, drop_temporary=<optimized out>, drop_sequence=<optimized out>, dont_log_query=dont_log_query@entry=false) at /test/10.5_dbg/sql/sql_table.cc:2143
#10 0x000055676e808307 in mysql_execute_command (thd=thd@entry=0x1515bac15088) at /test/10.5_dbg/sql/sql_parse.cc:4921
#11 0x000055676e812752 in mysql_parse (thd=thd@entry=0x1515bac15088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1515df245350, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7993
#12 0x000055676e7ff204 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x1515bac15088, packet=packet@entry=0x1515bac67089 "DROP SEQUENCE IF EXISTS t", packet_length=packet_length@entry=25, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1866
#13 0x000055676e7fd9de in do_command (thd=0x1515bac15088) at /test/10.5_dbg/sql/sql_parse.cc:1347
#14 0x000055676e959c3b in do_handle_one_connection (connect=<optimized out>, connect@entry=0x1515be0c7808, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1411
#15 0x000055676e95a357 in handle_one_connection (arg=arg@entry=0x1515be0c7808) at /test/10.5_dbg/sql/sql_connect.cc:1313
#16 0x000055676edbdca8 in pfs_spawn_thread (arg=0x1515dc046508) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
#17 0x00001515de1bf6db in start_thread (arg=0x1515df246700) at pthread_create.c:463
#18 0x00001515dd5bda3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.3.24 (dbg), 10.4.14 (dbg), 10.5.5 (dbg)

Bug confirmed not present in:
MariaDB: 10.1.46 (dbg), 10.1.46 (opt), 10.2.33 (dbg), 10.2.33 (opt), 10.3.24 (opt), 10.4.14 (opt), 10.5.5 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

DROP SEQUENCE not available in 10.2, so not a regression.



 Comments   
Comment by Roel Van de Paar [ 2020-07-18 ]

Slightly different crash on bit older 10.5.5 build with same testcase, due to changed '->' idioms.

10.5.5 e1013725ce0f3f947e728491eef75d9985e8db2f (Debug)

mysqld: /test/10.5_dbg/sql/sql_table.cc:2409: 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.

10.5.5 e1013725ce0f3f947e728491eef75d9985e8db2f (Debug)

Core was generated by `/test/MD250620-mariadb-10.5.5-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
[Current thread is 1 (Thread 0x151226fdb700 (LWP 1523800))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x0000564ff846b7d0 in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
#2  0x0000564ff7c2447a in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00001512252718b1 in __GI_abort () at abort.c:79
#6  0x000015122526142a in __assert_fail_base (fmt=0x1512253e8a38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x564ff8604a00 "thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_SHARED)", file=file@entry=0x564ff86041e8 "/test/10.5_dbg/sql/sql_table.cc", line=line@entry=2409, function=function@entry=0x564ff8607140 <mysql_rm_table_no_locks(THD*, TABLE_LIST*, bool, bool, bool, bool, bool, bool)::__PRETTY_FUNCTION__> "int mysql_rm_table_no_locks(THD*, TABLE_LIST*, bool, bool, bool, bool, bool, bool)") at assert.c:92
#7  0x00001512252614a2 in __GI___assert_fail (assertion=assertion@entry=0x564ff8604a00 "thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, table->table_name.str, MDL_SHARED)", file=file@entry=0x564ff86041e8 "/test/10.5_dbg/sql/sql_table.cc", line=line@entry=2409, function=function@entry=0x564ff8607140 <mysql_rm_table_no_locks(THD*, TABLE_LIST*, bool, bool, bool, bool, bool, bool)::__PRETTY_FUNCTION__> "int mysql_rm_table_no_locks(THD*, TABLE_LIST*, bool, bool, bool, bool, bool, bool)") at assert.c:101
#8  0x0000564ff7a3bfd4 in mysql_rm_table_no_locks (thd=thd@entry=0x151202c15088, tables=tables@entry=0x151202c74170, if_exists=if_exists@entry=true, drop_temporary=drop_temporary@entry=false, drop_view=drop_view@entry=false, drop_sequence=drop_sequence@entry=true, dont_log_query=false, dont_free_locks=false) at /test/10.5_dbg/sql/sql_table.cc:2407
#9  0x0000564ff7a3df82 in mysql_rm_table (thd=thd@entry=0x151202c15088, tables=tables@entry=0x151202c74170, if_exists=<optimized out>, drop_temporary=<optimized out>, drop_sequence=<optimized out>, dont_log_query=dont_log_query@entry=false) at /test/10.5_dbg/sql/sql_table.cc:2143
#10 0x0000564ff797c213 in mysql_execute_command (thd=thd@entry=0x151202c15088) at /test/10.5_dbg/sql/sql_parse.cc:4929
#11 0x0000564ff7986638 in mysql_parse (thd=thd@entry=0x151202c15088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x151226fda350, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7995
#12 0x0000564ff7973110 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x151202c15088, packet=packet@entry=0x151202c67089 "DROP SEQUENCE IF EXISTS t", packet_length=packet_length@entry=25, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1874
#13 0x0000564ff79718ea in do_command (thd=0x151202c15088) at /test/10.5_dbg/sql/sql_parse.cc:1355
#14 0x0000564ff7acd15f in do_handle_one_connection (connect=<optimized out>, connect@entry=0x1512060d2808, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1411
#15 0x0000564ff7acd87b in handle_one_connection (arg=arg@entry=0x1512060d2808) at /test/10.5_dbg/sql/sql_connect.cc:1313
#16 0x0000564ff7f3011c in pfs_spawn_thread (arg=0x151223c46508) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
#17 0x0000151225f546db in start_thread (arg=0x151226fdb700) at pthread_create.c:463
#18 0x0000151225352a3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Comment by Elena Stepanova [ 2020-07-18 ]

This is a literal duplicate of MDEV-19273.

Comment by Roel Van de Paar [ 2020-07-27 ]

Hmm yes, thank you. Not sure why search did not find that, maybe the changed syntax. Thank you, marking as such.

Generated at Thu Feb 08 09:20:39 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.