Bug #50787 Crash in MDL_ticket::is_incompatible_when_granted()
Submitted: 1 Feb 2010 10:37 Modified: 1 Feb 2010 18:14
Reporter: Philip Stoev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Locking Severity:S1 (Critical)
Version:mysql-next-4284-stage OS:Any
Assigned to: Dmitry Lenev CPU Architecture:Any

[1 Feb 2010 10:37] Philip Stoev
Description:
When executing the default RQG MDL workload with --log-output=file, mysqld crashed as follows:

#3  <signal handler called>
#4  0x00000000008405b9 in MDL_ticket::is_incompatible_when_granted (this=0x2c46090, type=MDL_SHARED_WRITE) at mdl.cc:1126
#5  0x0000000000840cb3 in MDL_lock::find_deadlock (this=0x2cd7ce0, waiting_ticket=0x2c45b90, deadlock_ctx=0x7f8ffc47da20) at mdl.cc:1677
#6  0x0000000000840bb0 in MDL_context::find_deadlock (this=0x7f8ff800aeb8, deadlock_ctx=0x7f8ffc47da20) at mdl.cc:1749
#7  0x0000000000840f26 in MDL_context::find_deadlock (this=0x7f8ff800aeb8) at mdl.cc:1779
#8  0x0000000000842287 in MDL_context::wait_for_lock (this=0x7f8ff800aeb8, mdl_request=0x2ea9a68) at mdl.cc:1875
#9  0x0000000000697063 in Open_table_context::recover_from_failed_open (this=0x7f8ffc47df30, thd=0x7f8ff800ade8, mdl_request=0x2ea9a68, table=0x2ea9738)
    at sql_base.cc:3833
#10 0x00000000006997a8 in open_tables (thd=0x7f8ff800ade8, start=0x7f8ffc47e000, counter=0x7f8ffc47e03c, flags=0, prelocking_strategy=0x7f8ffc47e080)
    at sql_base.cc:4531
#11 0x0000000000699c6a in open_and_lock_tables_derived (thd=0x7f8ff800ade8, tables=0x2ea9738, derived=true, flags=0, prelocking_strategy=0x7f8ffc47e080)
    at sql_base.cc:5106
#12 0x00000000006505d2 in open_and_lock_tables_derived (thd=0x7f8ff800ade8, tables=0x2ea9738, derived=true, flags=0) at mysql_priv.h:1500
#13 0x000000000065060d in open_and_lock_tables (thd=0x7f8ff800ade8, tables=0x2ea9738) at mysql_priv.h:1510
#14 0x000000000064836c in mysql_execute_command (thd=0x7f8ff800ade8) at sql_parse.cc:3015
#15 0x000000000064d541 in mysql_parse (thd=0x7f8ff800ade8,
    inBuf=0x2ea94e8 "INSERT   testdb_S . t1_part1_S  ( `col_int_key` , `pk` , `col_int`  ) SELECT HIGH_PRIORITY  `pk` , `col_int` , `col_int_key`  FROM testdb_S . t1_base1_S   A WHERE `pk` BETWEEN 9 AND 9 + 1 LIMIT 1", length=195, found_semicolon=0x7f8ffc47ff10) at sql_parse.cc:5592
#16 0x000000000064e191 in dispatch_command (command=COM_QUERY, thd=0x7f8ff800ade8,
    packet=0x7f8ff80624c9 "INSERT   testdb_S . t1_part1_S  ( `col_int_key` , `pk` , `col_int`  ) SELECT HIGH_PRIORITY  `pk` , `col_int` , `col_int_key`  FROM testdb_S . t1_base1_S   A WHERE `pk` BETWEEN 9 AND 9 + 1 LIMIT 1 ", packet_length=196) at sql_parse.cc:1011
#17 0x000000000064f662 in do_command (thd=0x7f8ff800ade8) at sql_parse.cc:695
#18 0x000000000063de31 in handle_one_connection (arg=0x7f8ff800ade8) at sql_connect.cc:1163
#19 0x000000315b0073da in start_thread () from /lib64/libpthread.so.0
#20 0x000000315a4e627d in clone () from /lib64/libc.so.6

How to repeat:
If this is repeatable, a simplified test case will be provided. The core and the binary will be made available in the meantime.
[1 Feb 2010 11:23] Philip Stoev
Core and binary:

http://mysql-systemqa.s3.amazonaws.com/var-bug50787.zip

Source:

revision-id: kostja@sun.com-20100129154650-wmq5gczzj868s66r
date: 2010-01-29 18:46:50 +0300
build-date: 2010-02-01 12:38:17 +0200
revno: 3084
branch-nick: mysql-next-4284-stage
[1 Feb 2010 15:19] Philip Stoev
Grammar for bug 50787

Attachment: bug50787.yy (application/octet-stream, text), 31.34 KiB.

[1 Feb 2010 15:21] Philip Stoev
To reproduce with the RQG:

$ perl runall.pl \
  --gendata=conf/WL5004_data.zz \
  --duration=120 \
  --queries=10000000 \
  --threads=10 \
  --basedir=/build/bzr/mysql-next-4284-stage \
  --mysqld=--innodb-lock-wait-timeout=1 \
  --mysqld=--log-output=file \
  --mysqld=--table-lock-wait-timeout=1 \
  --grammar=conf/bug50787.yy \
  --mem \
  --seed=0

Bug is not reproducible with 2 ot 5 threads. The grammar contains a lot of stuff, but the queries actually executed are like those:

INSERT INTO  . t1_base1_N SELECT * FROM test.table1_int_autoinc;
CREATE TABLE IF NOT EXISTS . t1_base2_N  LIKE test.table1_int_autoinc;
[1 Feb 2010 16:20] Philip Stoev
Not reproducible on mysql-next-4284
[1 Feb 2010 18:14] Dmitry Lenev
Hi!

Judging from the above test case this crash was caused by the
same problem as sporadic crashes of lock_multi_bug38499.test.
The latter were fixed by the following patch that was pushed
into mysql-next-4284 tree: http://lists.mysql.com/commits/98827.

Since this problem was reported against tree which is not publicly
available tree there is nothing to document. So I am simply closing
this bug.