Hi,
I'm wondering if the following scenario is a bug or designed, because if httpd
dies and leaves behind a pidfile containing a pid which later gets reused, the
httpd refuses to come back up. I've already seen this in production, where a
host has crashed and on coming back up the web server fails to start because
something else has grabed the pid.
To reproduce the problem I can do this:
[root@laptop httpd]# pkill -9 httpd
[root@laptop httpd]# pgrep httpd
[root@laptop httpd]# echo 1 > /var/run/httpd/httpd.pid
[root@laptop httpd]# /usr/sbin/httpd -k start
httpd: Could not reliably determine the server's fully qualified domain name,
using fe80::201:4aff:fe5e:5331 for ServerName
httpd (pid 1) already running
I wondered whether fedora 17 might have coded round this, but no:
[root@laptop httpd]# systemctl start httpd.service
Job failed. See system journal and 'systemctl status' for details.
[root@laptop httpd]# systemctl status httpd.service
httpd.service - The Apache HTTP Server (prefork MPM)
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
Active: failed (Result: resources) since Thu, 31 Jan 2013 21:05:36 +0000;
3s ago
Process: 2228 ExecStart=/usr/sbin/httpd $OPTIONS -k start (code=exited,
status=0/SUCCESS)
CGroup: name=systemd:/system/httpd.service
Jan 31 21:05:36 laptop httpd[2228]: httpd: Could not reliably determine the...me
Jan 31 21:05:36 laptop httpd[2228]: httpd (pid 1) already running
[root@laptop httpd]#
[root@laptop httpd]# pgrep httpd
[root@laptop httpd]#
I tested this out on RHEL6 which ships with httpd 2.2.15 and noted that doesn't
suffer the same problem so presumably a patch has gone into httpd since then,
but I can't see the logic for the situation above.
Thanks for any guidance on this.
Edward.