I have a VPS with 1GB of RAM running CentOS 5.4
It also has plesk running with a number of wordpress websites running with no issues - most of the time.
Recently, it seems that every so often, apache seems to fall over. If you call www.mysite.com it seems to time out.
I attempt a restart of apache and get the following error.
Stopping httpd: [FAILED]
Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
[FAILED]
Now I know 100% there is no other service running on port 80 other than apache. But apache doesn't seem to be responding to the stop command. It's almost like it's stuck in limbo!
Eventually I found that I can manually force apache to stop by running
killall -9 httpd
Then a restart command works.
My questions are:
1.) What would cause something like this to happen? The server doesn't get any major traffic to my knowledge. 2.) What can I do on the server to automatically execute the command above if it does happen when I'm not around to do it manually.
Thanks,
Ed
I had a similar problem with some plugins I was running, and until I diagnosed which one was causing the issue, I used
cron
to kill and restart apache and mysql every hour.This sort of problem (processes that won't exit normally) is often caused when the process is stuck waiting for i/o (e.g., from a network connection, local pipe, filesystem, etc). You can sometimes use strace to figure out what's going on, although using
strace
effectively is probably an entirely different question.The output of the following ps command line may be interesting:
This will tell you the "name of the kernel function in which the process is sleeping", which may help to direct your investigation.
I would look in all your Apache config files for the
Listen
directive to verify you have only one listen on port 80. In CentOS 6 there is a directive in ssl.conf and if you copy a directive from another http.conf in to the CentOS 6 box you will run in to this issue on 443 as well if you are not careful.