# InnoDB: Warning: a long semaphore wait: MySQL crash ！！！！

**URL:** <https://forums.percona.com/t/innodb-warning-a-long-semaphore-wait-mysql-crash/3170>\
**Category:** Other MySQL® Questions\
**Created:** [December 31, 2013, 7:54pm UTC](https://forums.percona.com/t/innodb-warning-a-long-semaphore-wait-mysql-crash/3170 "2013-12-31T19:54:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hiller](https://avatars.discourse-cdn.com/v4/letter/h/a587f6/32.png) [@hiller](https://forums.percona.com/u/hiller)\
**Post date:** [December 31, 2013, 7:54pm UTC](https://forums.percona.com/t/innodb-warning-a-long-semaphore-wait-mysql-crash/3170/1 "2013-12-31T19:54:51Z")

</div>

# InnoDB: Warning: a long semaphore wait: –Thread 140593224754944 has waited at btr0cur.c line 528 for 241.00 seconds the semaphore: X-lock on RW-latch at 0x7fd9142bfcc8 created in file dict0dict.c line 1838 a writer (thread id 140570526021376) has reserved it in mode exclusive number of readers 0, waiters flag 1, lock\_word: 0 Last time read locked in file btr0cur.c line 535 Last time write locked in file /pb2/build/sb\_0-10180689-1378752874.69/mysql-5.5.34/storage/innobase/btr/btr0cur.c line 528 InnoDB: Warning: a long semaphore wait: –Thread 140570431108864 has waited at btr0cur.c line 528 for 241.00 seconds the semaphore: X-lock on RW-latch at 0x7fd9142bfcc8 created in file dict0dict.c line 1838 a writer (thread id 140570526021376) has reserved it in mode exclusive number of readers 0, waiters flag 1, lock\_word: 0 Last time read locked in file btr0cur.c line 535 Last time write locked in file /pb2/build/sb\_0-10180689-1378752874.69/mysql-5.5.34/storage/innobase/btr/btr0cur.c line 528 …………………… END OF INNODB MONITOR OUTPUT

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.  
140101 4:32:58 InnoDB: Assertion failure in thread 140570570065664 in file srv0srv.c line 2502  
InnoDB: We intentionally generate a memory trap.  
InnoDB: Submit a detailed bug report to [http://bugs.mysql.com](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](http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html)  
InnoDB: about forcing recovery.  
20:32:58 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=16777216  
read\_buffer\_size=131072  
max\_used\_connections=608  
max\_threads=1600  
thread\_count=516  
connection\_count=515  
It is possible that mysqld could use up to  
key\_buffer\_size + (read\_buffer\_size + sort\_buffer\_size)\*max\_threads = 444459 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 0x30000  
/usr/local/mysql/bin/mysqld(my\_print\_stacktrace+0x35)[0x7a5f15]  
/usr/local/mysql/bin/mysqld(handle\_fatal\_signal+0x403)[0x673a13]  
/lib/libpthread.so.0(+0xef60)[0x7fde6901cf60]  
/lib/libc.so.6(gsignal+0x35)[0x7fde68219165]  
/lib/libc.so.6(abort+0x180)[0x7fde6821bf70]  
/usr/local/mysql/bin/mysqld[0x7ff2ce]  
/lib/libpthread.so.0(+0x68ba)[0x7fde690148ba]  
/lib/libc.so.6(clone+0x6d)[0x7fde682b602d]  
The manual page at [http://dev.mysql.com/doc/mysql/en/crashing.html](http://dev.mysql.com/doc/mysql/en/crashing.html) contains  
information that should help you find out what is causing the crash.  
140101 04:34:11 mysqld\_safe Number of processes running now: 0  
140101 04:34:11 mysqld\_safe mysqld restarted

How do I prevent this problem from happening again？？？Thanks!

---

<div class="post-metadata">

**Author:** ![niljoshi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/niljoshi/32/16889_2.png) [@niljoshi](https://forums.percona.com/u/niljoshi)\
**Post date:** [January 2, 2014, 3:39am UTC](https://forums.percona.com/t/innodb-warning-a-long-semaphore-wait-mysql-crash/3170/2 "2014-01-02T03:39:27Z")

</div>

Hi,

It seems there was long semaphore wait with dict0dict.c, btr0cur.c files and X-lock. Generally this could happen while someone adding index with ALTER TABLE . Can you check if someone ran ALTER TABLE at the same time when you face this issue? Can you provide full output of “SHOW INNODB ENGINE STATUS”, my.cnf and error.log file? pt-summary output will be also helpful to investigate this issue further.
