Rarely, CloudBolt's apache httpd service will fail to start with the symptoms below. This can occur for a few reasons, such as the system reaching the semaphore limit or the apache service being improperly terminated. This will result in stale semaphores being left behind after apache stops/dies, and can be resolved by purging those semaphores, increasing the semaphore limit, and ensuring that you always stop apache httpd with the service httpd stop
command.
Symptoms
- CloudBolt is unavailable with a 'Connection Refused' error in your browser, e.g.:
This site can’t be reached
10.0.0.100 refused to connect.
ERR_CONNECTION_REFUSED - Error message in /var/log/httpd/error_log:
[emerg] (28)No space left on device: Couldn't create accept lock (/etc/httpd/logs/accept.lock.28028) (5)
- Disk usage/free is normal
# df -h
- Apache says it's dead:
# service httpd status "httpd dead but pid file exists"
- Apache [re]start says 'OK' but dies with the error message in (1):
service httpd [re]start
Root Cause
- A semaphore limit has been reached.
- If main httpd thread should receive KILL signal instead of TERM, httpd won't remove the semaphores using semctl(IPC_RMID).
- Semaphore limits can be adjusted by echoing new values into /proc/sys/kernel/sem.
Source: https://access.redhat.com/solutions/55914
Source: https://access.redhat.com/solutions/89103
Diagnosis
- Confirm the symptoms listed at the top.
- Ensure apache is stopped with `ps`.
- Check the semaphore table while apache is stopped:
# ipcs -s
- If there are a bunch of apache semaphores, purge them:
# ipcs -s | awk '{ if ( $3 ~ /apache/ && $1 ~ /[0-9]/ ) system("ipcrm -s "$2) }'
- Verify semaphore table for apache is empty.
# ipcs -s
- Restart apache, check for symptoms:
# service httpd restart
- If not fixed, read the Red Hat guide for further help or contact CloudBolt Support.
- If fixed, increase your semaphore limits, as described below.
Resolution
- Check the semaphore limits
# cat /proc/sys/kernel/sem
250 32000 32 128 ^^^128=too low - Edit the output from the previous command, increasing the last entry (128 to 256 in this case) and reconfigure the system with the new limit:
# echo "kernel.sem=250 32000 32 256" >> /etc/sysctl.conf
- Apply your changes
# sysctl -p
- Verify your changes were applied
# cat /proc/sys/kernel/sem
250 32000 32 256
0 Comments