Bug #74684 semaphore wait has lasted > 600 seconds causes server to crash
Submitted: 4 Nov 2014 14:48 Modified: 5 Nov 2014 8:01
Reporter: Laurenz Albe Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.5.38 OS:Linux (RHEL 6.5 x86_64)
Assigned to: CPU Architecture:Any

[4 Nov 2014 14:48] Laurenz Albe
Description:
Every couple of days one of our MySQL servers crashes as follows:
First, there is a warning in the error log:

InnoDB: Warning: a long semaphore wait:
--Thread 140014166918912 has waited at row0ins.c line 2027 for 241.00 seconds the semaphore:
X-lock on RW-latch at 0x7f58cd043540 created in file buf0buf.c line 938
a writer (thread id 140014166918912) has reserved it in mode  exclusive
number of readers 0, waiters flag 1, lock_word: 0
Last time read locked in file row0sel.c line 2930
Last time write locked in file /home/laurenz/rpmbuild/BUILD/mysql-5.5.38/mysql-5.5.38/storage/innobase/buf/buf0buf.c line 3165

This is followed by several InnoDB monitor outputs and more "long semaphore wait" messages, until finally mysqld crashes:

InnoDB: ###### Diagnostic info printed to the standard error stream
InnoDB: Error: semaphore wait has lasted > 600 seconds
InnoDB: We intentionally crash the server, because it appears to be hung.
141101  6:01:11  InnoDB: Assertion failure in thread 140019263489792 in file srv0srv.c line 2502
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
05:01:11 UTC - 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=8388608
read_buffer_size=262144
max_used_connections=152
max_threads=151
thread_count=151
connection_count=151
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 357836 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0
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 = 0 thread_stack 0x40000
/magwien/mysql-5.5.38/sbin/mysqld(my_print_stacktrace+0x2e)[0x76115e]
/magwien/mysql-5.5.38/sbin/mysqld(handle_fatal_signal+0x41a)[0x65589a]
/lib64/libpthread.so.0[0x382ce0f710]
/lib64/libc.so.6(gsignal+0x35)[0x382c632635]
/lib64/libc.so.6(abort+0x175)[0x382c633e15]
/magwien/mysql-5.5.38/sbin/mysqld[0x79d8de]
/lib64/libpthread.so.0[0x382ce079d1]
/lib64/libc.so.6(clone+0x6d)[0x382c6e886d]
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
141101 06:01:11 mysqld_safe Number of processes running now: 0
141101 06:01:11 mysqld_safe mysqld restarted
141101  6:01:11 InnoDB: The InnoDB memory heap is disabled
141101  6:01:11 InnoDB: Mutexes and rw_locks use GCC atomic builtins
141101  6:01:11 InnoDB: Compressed tables use zlib 1.2.3
141101  6:01:11 InnoDB: Initializing buffer pool, size = 512.0M
141101  6:01:11 InnoDB: Completed initialization of buffer pool
141101  6:01:11 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 242038186820
141101  6:01:11  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.

I'll try to upload a bigger portion of the error log that contains the InnoDB Monitor output.

How to repeat:
I don't know how to repeat the problem.
[4 Nov 2014 14:54] Laurenz Albe
I have uploaded mysql-bug-data-74684.zip with more details from the error log.
[4 Nov 2014 22:46] MySQL Verification Team
Thank you for the bug report. Duplicate of http://bugs.mysql.com/bug.php?id=73890.
[5 Nov 2014 8:01] Laurenz Albe
That's probably right.

What can I do to help resolve this?