Bug #39822 Deadlock in innodb code when running with thread_pool.
Submitted: 2 Oct 2008 18:47 Modified: 2 Oct 2008 20:02
Reporter: Andrew Kostyagin Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: General Severity:S2 (Serious)
Version:mysql-6.0.6 OS:Linux
Assigned to: CPU Architecture:Any
Tags: deadlock, thread_pool

[2 Oct 2008 18:47] Andrew Kostyagin
Description:
I get deadlock when I run sysbench compex test for a mysql server which works with thread_pool.

Here is stack of all thread_pool threads when deadlock occurs:
#0  0x000000321d80a4b6 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00000000007f0385 in os_event_wait_low ()
#2  0x00000000008204b5 in srv_suspend_mysql_thread ()
#3  0x000000000080649a in row_mysql_handle_errors ()
#4  0x000000000081405e in row_search_for_mysql ()
#5  0x0000000000786f70 in ha_innobase::index_read ()
#6  0x00000000006a82ce in handler::read_range_first ()
#7  0x00000000006a4d3e in handler::multi_range_read_next ()
#8  0x000000000068e1f3 in QUICK_RANGE_SELECT::get_next ()
#9  0x00000000006a180d in rr_quick ()
#10 0x000000000064f7ed in mysql_update ()
#11 0x00000000005cb2b5 in mysql_execute_command ()
#12 0x0000000000646d18 in Prepared_statement::execute ()
#13 0x00000000006490f0 in Prepared_statement::execute_loop ()
#14 0x000000000064948d in mysql_stmt_execute ()
#15 0x00000000005cd9c8 in dispatch_command ()
#16 0x00000000005ce907 in do_command ()
#17 0x00000000005c177c in libevent_thread_proc ()
#18 0x000000321d806307 in start_thread () from /lib64/libpthread.so.0
#19 0x000000321d0d1ded in clone () from /lib64/libc.so.6

How to repeat:
- mysql version: mysql-6.0.6-alpha.tar.gz
- configure params: --with-innodb --with-libevent
- install mysql (make install, mysql_install_db)
- install sysbench (it is needed libs and headers for mysql-5.1)
- run mysqld with params: "--thread_handling=pool-of-threads --thread_pool_size=2" (here can be 1 or 4 threads - deadlock anyway).
- run this sysbench test:
> sysbench=sysbench; #path to sysbench executable
> mysql_user=mysql; #client user
> sb_prefix="$sysbench --test=oltp --oltp-test-mode=complex --mysql-user=$mysql_user --mysql-db=test --mysql-table-engine=innodb --oltp-table-size=30 --num-threads=128";
> $sb_prefix prepare; #ok
> $sb_prefix run; #deadlock!
> $sb_prefix cleanup; #unreachable

My Hardware/OS information:
1. 8-core server with 16G memory, Linux CentOS 5.2 x86_64.
2. 2-core desktop with 4G memory, Linux CentOS 5.2 x86_64.
[2 Oct 2008 20:02] Sveta Smirnova
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments to the original bug instead.

Thank you for your interest in MySQL.

Duplicate of bug #34399