Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question
1  
I'm assuming this is dynamic content, not just some html files and pictures. What language? How is it served? (eg fcgi? mod_whatever? separate application server like rails or jsp, with mod_whatever or by proxy?) –  DerfK Dec 8 '10 at 17:35
    
yes it's dynamic - WordPress (PHP) using fastcgi. –  Ed Bloom Dec 8 '10 at 20:45

3 Answers 3

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.

share|improve this answer
    
thanks Warren - good idea - might try that while i review plugins –  Ed Bloom Dec 8 '10 at 20:47

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:

ps -e -o pid,wchan:20,cmd | grep httpd

This will tell you the "name of the kernel function in which the process is sleeping", which may help to direct your investigation.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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