Bug #39363 Concurent inserts in the same table lead to hang in maria engine
Submitted: 10 Sep 2008 8:56 Modified: 9 Jan 2009 14:57
Reporter: Oleksandr Byelkin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Maria storage engine Severity:S2 (Serious)
Version:5.1-maria,6.0-maria OS:Any
Assigned to: Guilhem Bichot CPU Architecture:Any

[10 Sep 2008 8:56] Oleksandr Byelkin
Description:
many concurent inserts in the same maria table (transactional) lead to hangup (nothing happening, no CPU load)

How to repeat:
Prepare several files like this:
1. setup.txt:
drop table if exists t1;
create table t1 (a char(255)) engine=maria transactional=1;
insert into t1 values
("qwytfrqwytrqwytfqwhgfdshgfasgfcskjadshjgfadsjhgadsjhgadsjhgadjhg");
2. insert.txt:
insert into t1 values ("qwytfrqwfffffffffffytrqwytfqwhgfdshgfasgfcskjadshjgfadsjhgadsjhgadsjhgadjhg");
insert into t1 values ("qwytfrqwytrqwytdjfkgkhlkjdkkssfqwhgfdshgfasgfcskjadshjgfadsjhgadsjhgadsjhgadjhg");
insert into t1 values ("qwytfrqwytrqwytfqwhgfdshgfasgfcskjadshjgfadsjhgadsjhgadsjhgadjhg");
insert into t1 values ("qwytfrqwytrqwytdjfkkkssfqwhgfdshgfasgfcskjadshjgfadsjhgadsjhgadsjhgadjhg");
...
and so on (I have 593922 in the file like above but it is does not matter there should be juat a lot of inserts).
3) Script to start, test.sh:
./mysql --socket=../mysql-test/var/tmp/master.sock -u root test <setup.txt
./mysql --socket=../mysql-test/var/tmp/master.sock -u root test <insert.txt &
./mysql --socket=../mysql-test/var/tmp/master.sock -u root test <insert.txt &
./mysql --socket=../mysql-test/var/tmp/master.sock -u root test <insert.txt &
./mysql --socket=../mysql-test/var/tmp/master.sock -u root test <insert.txt &

Put this 3 files in client directory, then run several inserts simultaniousely:
cd mysql-test
./mysql-test-run --start-and-exit --mem alias
cd ../client
time bash test.sh
[10 Sep 2008 17:35] Guilhem Bichot
Sanja: please look into gdb what threads are doing. You use --mem, could it be that you hit out of memory and so threads wait for free memory?
[11 Sep 2008 6:33] Oleksandr Byelkin
Valgrind found nothing, but gdb showed asserting at:
    
  if (info->s->now_transactional)
  {
    DBUG_ASSERT((int) bitmap->non_flushable >= 0 &&
                info->non_flushable_state);
    info->non_flushable_state= 0;

it is ma_bitmap.c:2326 (_ma_bitmap_release_unused)
[18 Sep 2008 7:00] Guilhem Bichot
Let's fix bug#39210 first. Looking at code it's possible that it's the same cause as bug#39363.
[23 Sep 2008 9:20] Guilhem Bichot
I'll fix BUG#39210 first and then we'll see.
[29 Sep 2008 14:46] Philip Stoev
The assert is seen on PushBuild2, test maria_bulk_insert - 

http://clustra.norway.sun.com/~bteam/pb2/web.py?action=archive_download&archive_id=43675&p...
[17 Oct 2008 12:27] Guilhem Bichot
Got it today with latest 5.1-maria:
2311        DBUG_ASSERT(((int) (bitmap->non_flushable)) > 0);
I know the cause.
[17 Oct 2008 13:54] Guilhem Bichot
http://lists.mysql.com/maria/244 . Pushed in 5.1-maria.
[26 Oct 2008 22:20] Bugs System
Pushed into 6.0.8-alpha  (revid:guilhem@mysql.com-20081017133707-u102g238q80mwe3m) (version source revid:guilhem@mysql.com-20081020191322-i0e65e3k8044kkce) (pib:5)
[9 Jan 2009 14:57] MC Brown
A note has been added to 6.0.8 changelog: 

Multiple concurrent inserts to a Maria table could lead to a deadlock situation.