Oct 221998

httpd: could not bind to port 80 – how not to stop a process

see also Apache – starting/stopping.

Learning the hard way

Here’s what I was doing (don’t do this): killall httpd.  After a few times cycling httpd up and down, I found that httpd would not start at it.  Here’s the error message I was getting:
bind: Address already in use
httpd: could not bind to port 80.

I was confused.  I checked to see if httpd was already running by doing:

ps -auwd | grep httpd

But nothing was found.  So my next query was:

netstat -a | grep http
tcp 0 0 xxx-xxx-xxx-xxx.ip.http jagged.net.1224   ESTABLISHED
tcp 0 0 xxx-xxx-xxx-xxx.ip.http nt1.3917          CLOSE_WAIT
tcp 0 0 xxx-xxx-xxx-xxx.ip.http nt1.3916          CLOSE_WAIT

where xxx-xxx-xxx-xxx was the IP of my web server.  Nobody seemed to know what was going on.  Eventually, I rang Jay.  We talked for about 10 minutes and eventually decided that I had some zombie processes left over.  This was a result of the killall I had been doing.  So I had to reboot.  Unfortunately, I was at the following uptime:

3:39PM up 50 days,17:42, 4 users, load averages: 3.00, 3.00, 2.92

This had been a record for me.  Let’s see how the next one goes.