I got the following error in my MariaDB 10.x hostname.err log:

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.

Can someone please explain (as simply as possible ;-D) what a "semaphore wait" is within the context of MySQL/MariaDB?

All I could gather from Mr. Google is that they are "related to internal synchronization between threads in mysqld"

  • 1
    Scroll back in your error log. There should have been some prior warnings, such as --Thread %lu has waited at %s line %lu for %.2f seconds the semaphore: or InnoDB: Pending preads %lu, pwrites %lu. See anything? Also, what specific version of MariaDB 10.x.x are you running? The two most obvious causes of this are defective hardware -- such as a hard drive that is near failure but not actually returning errors because reads and/or writes eventually succeed but extremely slowly... or a bug in the server daemon itself causing a hang. – Michael - sqlbot Sep 13 '17 at 19:22

Semaphores throttle access to a resource. If it's not available a process has to wait until it is. Very long waits can signal that you have a deadlock situation and something needs to be killed to break it up.


A lock allows only one thread to enter the part that's locked and the lock is not shared with any other processes.

A mutex is the same as a lock but it can be system wide (shared by multiple processes).

A semaphore does the same as a mutex but allows x number of threads to enter, this can be used for example to limit the number of cpu, io or ram intensive tasks running at the same time.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.