Bug #50541 Assertion `! ticket->is_upgradable_or_exclusive()' failed in MDL_context::can...
Submitted: 22 Jan 2010 12:31 Modified: 24 Feb 2010 11:02
Reporter: John Embretsen Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Locking Severity:S1 (Critical)
Version:5.6.0_bzr (next-4284), 5.5 OS:Linux
Assigned to: Jon Olav Hauglid CPU Architecture:Any
Tags: pushbuild, rqg_pb2, test failure

[22 Jan 2010 12:31] John Embretsen
Description:
An assertion was hit during the concurrent Random Query Generator test rqg_mdl_stress in Pushbuild on "linux x86 sysqa" platform (debug binaries) in the branch mysql-next-4284.

mysqld: mdl.cc:1856: bool MDL_context::can_wait_lead_to_deadlock() const: Assertion `! ticket->is_upgradable_or_exclusive()' failed.
100122  0:58:11 - mysqld got signal 6 ;
This could be because you hit a bug.
(...)

Stacktrace:

(...)

# 22:58:13 #8  0x0074315b in __assert_fail () from /lib/libc.so.6
# 22:58:13 #9  0x0843f525 in MDL_context::can_wait_lead_to_deadlock (this=0xa691e388)
# 22:58:13     at mdl.cc:1856
# 22:58:13 #10 0x08440e5a in MDL_context::wait_for_locks (this=0xa691e388, 
# 22:58:13     mdl_requests=0xa68089b0) at mdl.cc:1915
# 22:58:13 #11 0x082a8454 in Open_table_context::recover_from_failed_open (
# 22:58:13     this=0xa68089b0, thd=0xa691e318, mdl_request=0xafe855c, table=0xafe8378)
# 22:58:13     at sql_base.cc:3843
# 22:58:13 #12 0x082aa8f9 in open_tables (thd=0xa691e318, start=0xa6808a44, 
# 22:58:13     counter=0xa6808a2c, flags=32, prelocking_strategy=0xa6808a70)
# 22:58:13     at sql_base.cc:4468
# 22:58:13 #13 0x082aad83 in open_and_lock_tables_derived (thd=0xa691e318, 
# 22:58:13     tables=0xafe8378, derived=true, flags=32, prelocking_strategy=0xa6808a70)
# 22:58:13     at sql_base.cc:5043
# 22:58:13 #14 0x0826401c in open_and_lock_tables_derived (thd=0xa691e318, 
# 22:58:13     tables=0xafe8378, derived=true, flags=32) at mysql_priv.h:1499
# 22:58:13 #15 0x083a0d4a in mysql_admin_table (thd=0xa691e318, tables=0xafe7fa8, 
# 22:58:13     check_opt=0xa691f9c0, operator_name=0x873152d "optimize", 
# 22:58:13     lock_type=TL_WRITE, open_for_modify=true, no_warnings_for_error=false, 
# 22:58:13     extra_open_options=0, prepare_func=0, operator_func=
# 22:58:13       {__pfn = 0x83785bc <handler::ha_optimize(THD*, st_ha_check_opt*)>, __delta = 0}, view_operator_func=0) at sql_table.cc:4597
# 22:58:13 #16 0x083a2a81 in mysql_optimize_table (thd=0xa691e318, tables=0xafe7fa8, 
# 22:58:13     check_opt=0xa691f9c0) at sql_table.cc:5083
# 22:58:13 #17 0x0825ad24 in mysql_execute_command (thd=0xa691e318) at sql_parse.cc:2834
# 22:58:13 #18 0x08260963 in mysql_parse (thd=0xa691e318, 
# 22:58:13     inBuf=0xafe7e90 "OPTIMIZE LOCAL TABLE testdb_S . t1_temp2_S  , testdb_N . t1_base2_N", length=67, found_semicolon=0xa680a278) at sql_parse.cc:5593
# 22:58:13 #19 0x08261a48 in dispatch_command (command=COM_QUERY, thd=0xa691e318, 
# 22:58:13     packet=0xa6916361 "", packet_length=68) at sql_parse.cc:1011
# 22:58:13 #20 0x08262cd6 in do_command (thd=0xa691e318) at sql_parse.cc:695
# 22:58:13 #21 0x08251ad2 in handle_one_connection (arg=0xa691e318) at sql_connect.cc:1163
# 22:58:13 #22 0x0089a45b in start_thread () from /lib/libpthread.so.0
# 22:58:13 #23 0x007f1c4e in clone () from /lib/libc.so.6

This is (most likely) the first time this assertion is seen in PB2. It first occurred following the push of revision dlenev@mysql.com-20100121204303-sr6d1436mac7x6vz on 2010-01-21.

How to repeat:
Run the Random Query Generator's WL5004_sql.yy grammar against mysql-next-4284 bazaar branch.

Linux, bash:

export CODE=/my/path/to/mysql-next-4284
bzr branch lp:randgen
cd randgen

perl ./pb2gentest.pl $CODE $CODE/mysql-test/var-randgen mysql-next-4284 rqg_mdl_stress

If, for some reason the pb2gentest.pl script fails, try running runall.pl directly:

perl runall.pl \ 
--mysqld=--loose-innodb-lock-wait-timeout=5 \ 
--mysqld=--table-lock-wait-timeout=5 \ 
--mysqld=--loose-skip-safemalloc \
--mysqld=--log-output=file \
--mysqld=--innodb \ 
--grammar=conf/WL5004_sql.yy \ 
--threads=10 \ 
--queries=1M \ 
--duration=1800 \ 
--reporters=Deadlock,ErrorLog,Backtrace,Shutdown \ 
--basedir=$CODE
[24 Feb 2010 11:02] Jon Olav Hauglid
Unable to reproduce this bug with RQG and the current version of mysql-next-4284.
Closing the bug as "Can't repeat" after discussing with John.