Red Hat Bugzilla – Bug 104698
Init script not too smart if squid dies without being shut down properly
Last modified: 2014-08-31 19:25:21 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR
Description of problem:
If the master squid process crashes, is not shut down correctly, or is shut
down using 'squid -k shutdown', the .pid file can be left intact, causing the
init script to fail when an attempt is made to restart squid. This is because
the presence of the .pid file indicates to the script that squid is still
running, when in fact it might not be.
Ideally the script needs to check for the presence of squid processes (perhaps
using 'ps') and if squid is listed as a running process do not attempt to
start a second copy. Relying on the .pid file is at best a hack and is not
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Start squid
2. Shut squid down manually, or have the master process crash and die
3. Attempt to restart squid
Actual Results: Squid shuts down leaving a .pid file behind, creating
problems when squid is restarted with the init script as it believes squid is
Expected Results: Squid should be able to be started and the pid file get
An easy way to do this may be to test for the presence of the squid.pid file in
the start() routine, and if it does exist, run:
kill -0 `cat /var/run/squid.pid`
Test for a return code, if no return code then squid is still really running and
an error should be reported back. If something like 'kill - no such process' is
returned, then the pid file needs to be deleted and/or overwritten as it is
stale, and squid should be started.
This seems to work fine in rawhide--after stopping squid with either squid -k
shutdown or kill -9 "service squid start" started it without a problem.
Ditto, seems to be ok now. I'm happy for this to stay closed.