Bug #18116 MySQL 5.0 deadlocks while writing binary log
Submitted: 9 Mar 2006 20:49 Modified: 6 Apr 2006 0:17
Reporter: Peter Zaitsev (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S2 (Serious)
Version:5.0.18 OS:Linux (linux)
Assigned to: Lars Thalmann CPU Architecture:Any

[9 Mar 2006 20:49] Peter Zaitsev
Description:
Under stress load MySQL 5.0 deadlocks while writing binary log.  This happens both with LinuxThreads and NPTL.       

It takes hours for deadlock to show itself. 

MySQL 4.1 does not have this problem, also if logging is disabled in MySQL 5.0 it does not deadlock.

Here is sample backtrace for locked thread:

  0x0000003ea9f0ad1b in __lll_mutex_lock_wait () from /lib64/tls/libpthread.so.0
No symbol table info available.
#1  0xfefeff2accff7371 in ?? ()
No symbol table info available.
#2  0x0000002badae2a1b in ?? ()
No symbol table info available.
#3  0x0000003ea9f07b04 in pthread_mutex_lock () from /lib64/tls/libpthread.so.0
No symbol table info available.
#4  0x0000000000000002 in ?? ()
No symbol table info available.
#5  0x0000002bc9af4a78 in ?? ()
No symbol table info available.
#6  0x0000000000000060 in ?? ()
No symbol table info available.
#7  0x0000002bc9a81690 in ?? ()
No symbol table info available.
#8  0x0000002bc9a819a0 in ?? ()
No symbol table info available.
#9  0x0000002bc9a81590 in ?? ()
No symbol table info available.
#10 0x0000002bc9dc7d08 in ?? ()
No symbol table info available.
#11 0x00000000006f65be in mutex_enter_func (mutex=0x666544, file_name=0x456dfe20 "�\022\202", line=11429024)
    at ./../include/os0sync.ic:43
No locals.
#12 0x00000000005a6223 in MYSQL_LOG::write (this=0x6f6574, event_info=0x2bccc71d80) at log.cc:1604
        local_db = Variable "local_db" is not available.
(gdb) thread 4
[Switching to thread 4 (Thread 1171769696 (LWP 19643))]#0  0x0000003ea9f0ad1b in __lll_mutex_lock_wait ()
   from /lib64/tls/libpthread.so.0

How to repeat:
see above
[11 Mar 2006 8:40] Heikki Tuuri
The hangs in prepared statements reported by Jeff and Anda may be associated with this. See the end of:

http://bugs.mysql.com/bug.php?id=15868
[30 Mar 2006 17:23] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/4332
[31 Mar 2006 9:48] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/4360
[31 Mar 2006 10:23] Lars Thalmann
Pushed into release clone for 5.0.20
[6 Apr 2006 0:17] Paul DuBois
Noted in 5.0.20 changelog.

The server could deadlock under heavy load while writing to the binary log.