Problem Restarting Apache

[Fri Mar 31 04:44:20.842898 2017] [:error] [pid 25467] (28)No space left on device: mod_python: Failed to create global mutex 2 of 8 (/tmp/mpmtx254672).

[Fri Mar 31 04:44:20.842912 2017] [:error] [pid 25467] mod_python: We can probably continue, but with diminished ability to process session locks.

[Fri Mar 31 04:44:20.842914 2017] [:error] [pid 25467] mod_python: Hint: On Linux, the problem may be the number of available semaphores, check ‘sysctl kernel.sem’

[Fri Mar 31 04:44:20.868130 2017] [mpm_prefork:notice] [pid 25467] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips mod_fcgid/2.3.9 PHP/5.6.30 mod_python/3.5.0- Python/2.7.5 mod_jk/1.2.42 configured — resuming normal operations

To solve :

This error completely stumped me a couple of weeks ago. Apparently someone was adjusting the Apache configuration, then they checked their syntax and attempted to restart Apache. It went down without a problem, but it refused to start properly, and didn’t bind to any ports.

Within the Apache error logs, this message appeared over and over:

Apache is basically saying “I want to start, but I need to write some things down before I can start, and I have nowhere to write them!” If this happens to you, check these items in order:

1. Check your disk space
This comes first because it’s the easiest to check, and sometimes the quickest to fix. If you’re out of disk space, then you need to fix that problem. 🙂

2. Review filesystem quotas
If your filesystem uses quotas, you might be reaching a quota limit rather than a disk space limit. Use repquota / to review your quotas on the root partition. If you’re at the limit, raise your quota or clear up some disk space. Apache logs are usually the culprit in these situations.

3. Clear out your active semaphores
Semaphores? What the heck is a semaphore? Well, it’s actually an apparatus for conveying information by means of visual signals. But, when it comes to programming, semaphores are used for communicating between the active processes of a certain application. In the case of Apache, they’re used to communicate between the parent and child processes. If Apache can’t write these things down, then it can’t communicate properly with all of the processes it starts.

I’d assume if you’re reading this article, Apache has stopped running. Run this command as root:

If you see a list of semaphores, Apache has not cleaned up after itself, and some semaphores are stuck. Clear them out with this command:

Now, in almost all cases, Apache should start properly. If it doesn’t, you may just be completely out of available semaphores. You may want to increase your available semaphores, and you’ll need to tickle your kernel to do so. Add this to /etc/sysctl.conf:

And then run sysctl -p to pick up the new changes.

Restart : service httpd restart