Bug #45210 Combination of procedures, flush tables and autocommit crashes the mysql server
Submitted: 30 May 2009 23:00 Modified: 31 Aug 2009 10:29
Reporter: Hema Sridharan Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Locking Severity:S3 (Non-critical)
Version:5.4.4, mysql-6.0-backup, 6.0, azalea OS:Linux
Assigned to: Assigned Account CPU Architecture:Any
Tags: locking, mdl, metadata, regression

[30 May 2009 23:00] Hema Sridharan
Description:
Mysql server crashes when random queries are generated for creating procedures 

with combination of autocommit and flush tables.

Program terminated with signal 6, Aborted.
#0  0x00000036a3c0b122 in pthread_kill () from /lib64/libpthread.so.0
#0  0x00000036a3c0b122 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000000d8cdb7 in my_write_core (sig=6) at stacktrace.c:309
#2  0x0000000000731ad3 in handle_segfault (sig=6) at mysqld.cc:2713
#3  <signal handler called>
#4  0x00000036a3030045 in raise () from /lib64/libc.so.6
#5  0x00000036a3031ae0 in abort () from /lib64/libc.so.6
#6  0x00000036a3029756 in __assert_fail () from /lib64/libc.so.6
#7  0x000000000096295b in MDL_context::wait_for_locks (this=0x19a24448)
at mdl.cc:1306
#8  0x000000000079dd13 in recover_from_failed_open_table_attempt (
thd=0x19a24370, table=0x4e4bb230, action=OT_BACK_OFF_AND_RETRY)
at sql_base.cc:3525
#9  0x000000000079f449 in open_ltable (thd=0x19a24370, table_list=0x4e4bb230, 
lock_type=TL_WRITE, lock_flags=0) at sql_base.cc:4141
#10 0x000000000079f829 in open_system_table_for_update (thd=0x19a24370, 
one_table=0x4e4bb230) at sql_base.cc:8074
#11 0x0000000000931058 in open_proc_table_for_update (thd=0x19a24370)
at sp.cc:279
#12 0x00000000009315ab in sp_drop_routine (thd=0x19a24370, type=2, 
name=0x19823698) at sp.cc:1000
#13 0x000000000074a0bb in mysql_execute_command (thd=0x19a24370)
at sql_parse.cc:4560
#14 0x000000000074b1dc in mysql_parse (thd=0x19a24370, 
inBuf=0x2aaab0109ae8 "DROP PROCEDURE IF EXISTS db2.f", length=30, 
found_semicolon=0x4e4bcf20) at sql_parse.cc:5937
#15 0x000000000074c44b in dispatch_command (command=COM_QUERY, thd=0x19a24370, 
packet=0x18ce94b1 "DROP PROCEDURE IF EXISTS db2.f", packet_length=30)
at sql_parse.cc:1049
#16 0x000000000074d8b3 in do_command (thd=0x19a24370) at sql_parse.cc:731
#17 0x000000000073a8a4 in handle_one_connection (arg=0x19a24370)
at sql_connect.cc:1146
#18 0x00000036a3c062e7 in start_thread () from /lib64/libpthread.so.0
#19 0x00000036a30ce3bd in clone () from /lib64/libc.so.6
Using host libthread_db library "/lib64/libthread_db.so.1"

mysqld: mdl.cc:1306: bool MDL_context::wait_for_locks(): Assertion 

`mdl_request->ticket == __null' failed.
090531  1:05:39 - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=1048576
read_buffer_size=131072
max_used_connections=11
max_threads=151
thread_count=11
connection_count=11
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 60735 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd: 0x19a24370
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x4e4bd0f0 thread_stack 0x40000
/export/home/tmp/wl4195c/mysql-6.0-backup/sql/mysqld(my_print_stacktrace+0x32) 

[0xd8cd0b]
/export/home/tmp/wl4195c/mysql-6.0-backup/sql/mysqld(handle_segfault+0x2a6) 

[0x7318ea]
/lib64/libpthread.so.0 [0x36a3c0de60]
/lib64/libc.so.6(gsignal+0x35) [0x36a3030045]
/lib64/libc.so.6(abort+0x110) [0x36a3031ae0]
/lib64/libc.so.6(__assert_fail+0xf6) [0x36a3029756]
/export/home/tmp/wl4195c/mysql-6.0-backup/sql/mysqld(MDL_context::wait_for_loc

ks()+0xf7) [0x96295b]
/export/home/tmp/wl4195c/mysql-6.0-backup/sql/mysqld [0x79dd13]
/export/home/tmp/wl4195c/mysql-6.0-backup/sql/mysqld(open_ltable(THD*, 

TABLE_LIST*, thr_lock_type, unsigned int)+0x8f) [0x79f449]
/export/home/tmp/wl4195c/mysql-6.0-backup/sql/mysqld(open_system_table_for_upd

ate(THD*, TABLE_LIST*)+0x55) [0x79f829]
/export/home/tmp/wl4195c/mysql-6.0-backup/sql/mysqld [0x931058]
/export/home/tmp/wl4195c/mysql-6.0-backup/sql/mysqld(sp_drop_routine(THD*, 

int, sp_name*)+0x95) [0x9315ab]
/export/home/tmp/wl4195c/mysql-6.0-backup/sql/mysqld(mysql_execute_command(THD

*)+0x79b5) [0x74a0bb]
/export/home/tmp/wl4195c/mysql-6.0-backup/sql/mysqld(mysql_parse(THD*, char 

const*, unsigned int, char const**)+0x278) [0x74b1dc]
/export/home/tmp/wl4195c/mysql-6.0-backup/sql/mysqld(dispatch_command(enum_ser

ver_command, THD*, char*, unsigned int)+0x939) [0x74c44b]
/export/home/tmp/wl4195c/mysql-6.0-backup/sql/mysqld(do_command(THD*)+0x227) 

[0x74d8b3]
/export/home/tmp/wl4195c/mysql-6.0-backup/sql/mysqld(handle_one_connection+0x1

1a) [0x73a8a4]
/lib64/libpthread.so.0 [0x36a3c062e7]
/lib64/libc.so.6(clone+0x6d) [0x36a30ce3bd]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x2aaab0109ae8 is an invalid pointer
thd->thread_id=9
thd->killed=NOT_KILLED

How to repeat:
perl runall.pl --basedir=/export/home/tmp/wl4195c/mysql-6.0-backup/ --grammar=/export/home/tmp/perl_new/mysql-test-extra-6.0/mysql-test/gentest/conf/mytest2_crash_debug.yy

Please take a look at the grammar file attached and execute the test.

I was able to reproduce the crash but couldn't find the root cause.
[30 May 2009 23:01] Hema Sridharan
Please take a look at the attached grammar file

Attachment: mytest_crash.yy (application/octet-stream, text), 1.69 KiB.

[31 May 2009 0:33] Sveta Smirnova
Thank you for the report.

Verified as described.
[6 Jul 2009 11:25] Philip Stoev
This is a locking bug, setting category and lead.
[14 Aug 2009 15:06] Konstantin Osipov
This doesn't use any backup features, needs to be re-verified
against the latest mysql-next-bugfixing (5.4.4) tree.
[14 Aug 2009 15:34] Sveta Smirnova
Konstantin,

FYI it was verified with version 6.0 in time when bug was verified first time.
[14 Aug 2009 15:51] Sveta Smirnova
Bug is still repeatable.
[14 Aug 2009 16:15] Konstantin Osipov
Please re-triage -  a regression in azalea.
[16 Aug 2009 17:53] Philip Stoev
Also see bug#46748 - same backtrace, different workload.
[31 Aug 2009 10:29] Jon Olav Hauglid
Duplicate of Bug#46748
No longer reproduceable.