Apache crashes and won't restart normally

6 posts / 0 new
Last post
#1 Sun, 12/04/2011 - 17:18
newbie455

Apache crashes and won't restart normally

I have been having this issue for ages now (probably over a year) but have never been able to figure out what's causing it. Basically apache will crash at random times, and the only way I have found to restart it is to do a "killall httpd" followed by "service apache start". If after it crashes, I try to restart using the init script, I get the following message:

Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down

I have put apache in debug mode, checked the error log, access log, etc and haven't been able to find any reason this could be occurring. Since it only occurs at random times (sometimes it takes up to 2 or 3 weeks but recently it has been happening every couple days), it's hard to tell if anything I do has fixed it.

Does anyone have any suggestions? Thanks

Sun, 12/04/2011 - 17:24
newbie455

I might add that when apache crashes, "service httpd status" says apache is running. So really, the symptoms are that the service 1) cannot be restarted normally and 2) will not respond to httpd requests (when trying to access sites hosted on this server, it simply times out)

Virtualmin shows apache as "stopped"

Sun, 12/04/2011 - 21:55
andreychek

Howdy,

How much RAM is in your computer? You can determine that by running "free -m". Also, are you on a VPS, or is this a dedicated server?

Lastly -- do you see any errors in the Apache error log, in /var/log/httpd/error_log?

-Eric

Mon, 12/05/2011 - 02:32
newbie455

I appreciate the quick response. I did indeed check memory and the error logs (in debug level) to no avail.

After doing a bunch of testing (using strace), I came to the conclusion that this had something to do with the writing of log files/logrotate. When I was testing logrotate, I was able to get apache to the point that I could not restart it with the restart command but was not able to replicate the issue where apache does not respond on port 80...I'm assuming the 2 were related.

Anyway, I modified my logrotate postscripts for apache logs to do a graceful restart instead of a full restart so I'll see if that fixed the issue. From what I've read, I think it will. Fingers crossed.

I'll post back if the issue returns.

Mon, 12/05/2011 - 02:45 (Reply to #4)
cyrus

See if this thread helps.

Mon, 12/05/2011 - 14:31
newbie455

Yeah I saw that thread once I figured out that logrotate was causing a problem. That's exactly what I did so I think it is probably fixed but I'll only know for sure after a month has passed and apache hasn't crashed. Thanks

Topic locked