Bug #39210 Maria deadlock in _ma_bitmap_wait_or_flush

Submitted: 3 Sep 2008 11:19 Modified: 9 Jan 2009 14:58
Reporter: Philip Stoev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Maria storage engine Severity:S1 (Critical)
Version:5.1-maria, 6.0-maria OS:Any
Assigned to: Guilhem Bichot CPU Architecture:Any

[3 Sep 2008 11:19] Philip Stoev
Description:
When executing a very simple scenario of SELECT/INSERT/DELETE/UPDATE queries, Maria deadlocked with this thread selecting:

# 2008-09-01 22:10:36 [8484] Thread 11 (process 8499):
# 2008-09-01 22:10:36 [8484] #0  0x00a7d402 in __kernel_vsyscall ()
# 2008-09-01 22:10:36 [8484] #1  0x0089e256 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
# 2008-09-01 22:10:36 [8484] #2  0x0862ec85 in safe_cond_wait (cond=0x98148dc, mp=0x9814898, 
# 2008-09-01 22:10:36 [8484]     file=0x87d483b "ma_bitmap.c", line=326) at thr_mutex.c:249
# 2008-09-01 22:10:36 [8484] #3  0x085ac0d4 in _ma_bitmap_wait_or_flush (share=0x9814368) at ma_bitmap.c:326
# 2008-09-01 22:10:36 [8484] #4  0x085a6e43 in _ma_scan_init_block_record (info=0xb128e738)
# 2008-09-01 22:10:36 [8484]     at ma_blockrec.c:4988
# 2008-09-01 22:10:36 [8484] #5  0x08591859 in maria_scan_init (info=0xb128e738) at ma_scan.c:29
# 2008-09-01 22:10:36 [8484] #6  0x0857501b in ha_maria::rnd_init (this=0xb12817c8, scan=true)
# 2008-09-01 22:10:36 [8484]     at ha_maria.cc:2088
# 2008-09-01 22:10:36 [8484] #7  0x08173dfd in handler::ha_rnd_init (this=0xb12817c8, scan=true)
# 2008-09-01 22:10:36 [8484]     at handler.h:1184
# 2008-09-01 22:10:36 [8484] #8  0x083562ce in init_read_record (info=0x988be30, thd=0x9888718, 
# 2008-09-01 22:10:36 [8484]     table=0xb120d790, select=0xb121a1c8, use_record_cache=1, print_error=true)
# 2008-09-01 22:10:36 [8484]     at records.cc:234
# 2008-09-01 22:10:36 [8484] #9  0x082b5802 in join_init_read_record (tab=0x988bdf0) at sql_select.cc:11898
# 2008-09-01 22:10:36 [8484] #10 0x082b50d5 in sub_select (join=0x988a7c0, join_tab=0x988bdf0, 
# 2008-09-01 22:10:36 [8484]     end_of_records=false) at sql_select.cc:11227
# 2008-09-01 22:10:36 [8484] #11 0x082bcfe1 in do_select (join=0x988a7c0, fields=0x988b928, table=0x0, 
# 2008-09-01 22:10:36 [8484]     procedure=0x0) at sql_select.cc:10984
# 2008-09-01 22:10:36 [8484] #12 0x082d4ace in JOIN::exec (this=0x988a7c0) at sql_select.cc:2201
# 2008-09-01 22:10:36 [8484] #13 0x082d0257 in mysql_select (thd=0x9888718, rref_pointer_array=0x9889bb4, 
# 2008-09-01 22:10:36 [8484]     tables=0x988a370, wild_num=0, fields=@0x9889b50, conds=0x988a660, 
# 2008-09-01 22:10:36 [8484]     og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, 
# 2008-09-01 22:10:36 [8484]     select_options=2148289024, result=0x988a7b0, unit=0x988984c, 
# 2008-09-01 22:10:36 [8484]     select_lex=0x9889abc) at sql_select.cc:2379
# 2008-09-01 22:10:36 [8484] #14 0x082d4dc4 in handle_select (thd=0x9888718, lex=0x98897f0, 
# 2008-09-01 22:10:36 [8484]     result=0x988a7b0, setup_tables_done_option=0) at sql_select.cc:279
# 2008-09-01 22:10:36 [8484] #15 0x08252217 in execute_sqlcom_select (thd=0x9888718, all_tables=0x988a370)
# 2008-09-01 22:10:36 [8484]     at sql_parse.cc:4774
# 2008-09-01 22:10:36 [8484] #16 0x082539fb in mysql_execute_command (thd=0x9888718) at sql_parse.cc:2072
# 2008-09-01 22:10:36 [8484] #17 0x0825c671 in mysql_parse (thd=0x9888718, 
# 2008-09-01 22:10:36 [8484]     inBuf=0x988a0d0 "SELECT COUNT( X . time_nokey ) FROM E AS X WHERE X . datetime_key > ' g '", length=73, found_semicolon=0xb200f26c) at sql_parse.cc:5652
# 2008-09-01 22:10:36 [8484] #18 0x0825d1cc in dispatch_command (command=COM_QUERY, thd=0x9888718, 
# 2008-09-01 22:10:36 [8484]     packet=0x9890fe9 "", packet_length=73) at sql_parse.cc:1129
# 2008-09-01 22:10:36 [8484] #19 0x0825e2d6 in do_command (thd=0x9888718) at sql_parse.cc:789
# 2008-09-01 22:10:36 [8484] #20 0x0824c14f in handle_one_connection (arg=0x9888718) at sql_connect.cc:1115
# 2008-09-01 22:10:36 [8484] #21 0x0089a45b in start_thread () from /lib/libpthread.so.0
# 2008-09-01 22:10:36 [8484] #22 0x007f1c4e in clone () from /lib/libc.so.6

How to repeat:
To repeat, please clone the mysql-test-extra-6.0 tree, which is a non-server tree containing the test framework and then execute:

$ cd mysql-test-extra-6.0/mysql-test/gentest
$ runall.pl \ 
  --basedir=/path/to/mysql-6.0-maria \
  --engine=Maria \ 
  --grammar=conf/maria_stress.yy \ 
  --queries=100000

The test will deadlock shortly after takeoff. In 5 min, the framework will detect the deadlock, produce core and dump the stack traces.
[13 Oct 2008 21:15] Guilhem Bichot
First patch at http://lists.mysql.com/maria/215 .
But I need to think about it more.
With it, maria_stress.yy last for one hour without problem :)
[14 Oct 2008 15:20] Guilhem Bichot
queued to 5.1-maria. http://lists.mysql.com/maria/217
[26 Oct 2008 22:19] Bugs System
Pushed into 6.0.8-alpha  (revid:guilhem@mysql.com-20081014093807-atbgvpxmh4hwotfr) (version source revid:guilhem@mysql.com-20081020191322-i0e65e3k8044kkce) (pib:5)
[9 Jan 2009 14:58] MC Brown
A note has been added to the 6.0.8 changelog: 

Running multiple SELECT, INSERT, UPDATE and DELETE queries on the Maria table could lead to a deadlock.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.058 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.