[MDEV-25738] Assertion `ticket->m_duration == MDL_EXPLICIT' failed in void MDL_context::release_lock(MDL_ticket*) Created: 2021-05-20  Updated: 2021-06-07  Resolved: 2021-05-23

Status: Closed
Project: MariaDB Server
Component/s: N/A
Affects Version/s: 10.5, 10.6
Fix Version/s: 10.6.2, 10.5.11

Type: Bug Priority: Major
Reporter: Ramesh Sivaraman Assignee: Michael Widenius
Resolution: Cannot Reproduce Votes: 0
Labels: not-10.2, not-10.3

Issue Links:
Relates
relates to MDEV-25606 Concurrent CREATE TRIGGER statements ... Closed
relates to MDEV-25651 Server crash or assertion failure in ... Closed
relates to MDEV-25708 THD::cleanup(): Assertion `!mdl_conte... Closed
relates to MDEV-25867 main.trigger-trans failed in bb, Asse... Closed

 Description   

The crash is happening only if we set max_statement_time to 0.001 and this issue might be similar to MDEV-25735.

CREATE TABLE t1 (id int(11)) ENGINE=InnoDB;
SET max_statement_time = 0.001;
LOCK TABLES t1 WRITE;
CREATE TRIGGER tr16 AFTER UPDATE ON t1 FOR EACH ROW INSERT INTO t1 VALUES (1);

Leads to:

10.6.1 adb0fdb268c6b461a130c27f53a5244a3aa217e9 (Debug)

mysqld: /test/10.6_dbg/sql/mdl.cc:2841: void MDL_context::release_lock(MDL_ticket*): Assertion `ticket->m_duration == MDL_EXPLICIT' failed.

10.6.1 adb0fdb268c6b461a130c27f53a5244a3aa217e9 (Debug)

Core was generated by `/test/MD170521-mariadb-10.6.1-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
[Current thread is 1 (Thread 0x145db85fb700 (LWP 4080704))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x0000145dce456859 in __GI_abort () at abort.c:79
#2  0x0000145dce456729 in __assert_fail_base (fmt=0x145dce5ec588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x56091b71b4b0 "ticket->m_duration == MDL_EXPLICIT", file=0x56091b71a7f9 "/test/10.6_dbg/sql/mdl.cc", line=2841, function=<optimized out>) at assert.c:92
#3  0x0000145dce467f36 in __GI___assert_fail (assertion=assertion@entry=0x56091b71b4b0 "ticket->m_duration == MDL_EXPLICIT", file=file@entry=0x56091b71a7f9 "/test/10.6_dbg/sql/mdl.cc", line=line@entry=2841, function=function@entry=0x56091b71b4d8 "void MDL_context::release_lock(MDL_ticket*)") at assert.c:101
#4  0x000056091aba63bb in MDL_context::release_lock (this=this@entry=0x145d74000ee8, ticket=0x145d74020520) at /test/10.6_dbg/sql/mdl.cc:2841
#5  0x000056091ab25f34 in mysql_create_or_drop_trigger (thd=thd@entry=0x145d74000db8, tables=<optimized out>, create=create@entry=true) at /test/10.6_dbg/sql/sql_trigger.cc:652
#6  0x000056091aa45894 in mysql_execute_command (thd=thd@entry=0x145d74000db8) at /test/10.6_dbg/sql/sql_parse.cc:5808
#7  0x000056091aa2c5af in mysql_parse (thd=thd@entry=0x145d74000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x145db85fa410) at /test/10.6_dbg/sql/sql_parse.cc:8019
#8  0x000056091aa3b3d3 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x145d74000db8, packet=packet@entry=0x145d7400b799 "CREATE TRIGGER tr16 AFTER UPDATE ON t1 FOR EACH ROW INSERT INTO t1 VALUES (1)", packet_length=packet_length@entry=77, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1333
#9  0x000056091aa3e7cc in do_command (thd=0x145d74000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1406
#10 0x000056091ab98550 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x56091d112ca8, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
#11 0x000056091ab98b55 in handle_one_connection (arg=arg@entry=0x56091d112ca8) at /test/10.6_dbg/sql/sql_connect.cc:1312
#12 0x000056091b04cb00 in pfs_spawn_thread (arg=0x56091cffc4f8) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
#13 0x0000145dce964609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#14 0x0000145dce553293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

10.5.11 4d53a7585c532c2cfcea184259e3153f95b35683 (Debug)

mysqld: /test/10.5_dbg/sql/mdl.cc:2841: void MDL_context::release_lock(MDL_ticket*): Assertion `ticket->m_duration == MDL_EXPLICIT' failed.

10.5.11 4d53a7585c532c2cfcea184259e3153f95b35683 (Debug)

Core was generated by `/test/MD170521-mariadb-10.5.11-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
[Current thread is 1 (Thread 0x14eea04ad700 (LWP 4116885))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x000014eea9901859 in __GI_abort () at abort.c:79
#2  0x000014eea9901729 in __assert_fail_base (fmt=0x14eea9a97588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55f9a7fc3810 "ticket->m_duration == MDL_EXPLICIT", file=0x55f9a7fc2b59 "/test/10.5_dbg/sql/mdl.cc", line=2841, function=<optimized out>) at assert.c:92
#3  0x000014eea9912f36 in __GI___assert_fail (assertion=assertion@entry=0x55f9a7fc3810 "ticket->m_duration == MDL_EXPLICIT", file=file@entry=0x55f9a7fc2b59 "/test/10.5_dbg/sql/mdl.cc", line=line@entry=2841, function=function@entry=0x55f9a7fc3838 "void MDL_context::release_lock(MDL_ticket*)") at assert.c:101
#4  0x000055f9a73fde01 in MDL_context::release_lock (this=this@entry=0x14ee3c000ed8, ticket=0x14ee3c01e3f0) at /test/10.5_dbg/sql/mdl.cc:2841
#5  0x000055f9a737c480 in mysql_create_or_drop_trigger (thd=thd@entry=0x14ee3c000db8, tables=<optimized out>, create=create@entry=true) at /test/10.5_dbg/sql/sql_trigger.cc:652
#6  0x000055f9a729b0e7 in mysql_execute_command (thd=thd@entry=0x14ee3c000db8) at /test/10.5_dbg/sql/sql_parse.cc:5877
#7  0x000055f9a7281973 in mysql_parse (thd=thd@entry=0x14ee3c000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14eea04ac3d0, 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:8099
#8  0x000055f9a7290b47 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14ee3c000db8, packet=packet@entry=0x14ee3c00b4a9 "CREATE TRIGGER tr16 AFTER UPDATE ON t1 FOR EACH ROW INSERT INTO t1 VALUES (1)", packet_length=packet_length@entry=77, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_class.h:1271
#9  0x000055f9a7294396 in do_command (thd=0x14ee3c000db8) at /test/10.5_dbg/sql/sql_parse.cc:1370
#10 0x000055f9a73efa8d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55f9a9f0b358, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1410
#11 0x000055f9a73f0191 in handle_one_connection (arg=arg@entry=0x55f9a9f0b358) at /test/10.5_dbg/sql/sql_connect.cc:1312
#12 0x000055f9a78aaaa1 in pfs_spawn_thread (arg=0x55f9a9e55328) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
#13 0x000014eea9e0f609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#14 0x000014eea99fe293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.5.11 (dbg), 10.6.1 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.39 (dbg), 10.3.30 (dbg), 10.4.20 (dbg)



 Comments   
Comment by Marko Mäkelä [ 2021-05-20 ]

I wonder if this was caused by fixing MDEV-25606 or MDEV-25651.

Comment by Michael Widenius [ 2021-05-23 ]

I think this was fixed some time ago already (I remember fixing this bug).
At least it works for me now in latest 10.5
I have added the test case to 10.5

Comment by Michael Widenius [ 2021-05-23 ]

Pushed test case

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