Bug 104698 - Init script not too smart if squid dies without being shut down properly
Init script not too smart if squid dies without being shut down properly
Product: Fedora
Classification: Fedora
Component: squid (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jay Fenlason
Depends On:
  Show dependency treegraph
Reported: 2003-09-19 08:05 EDT by Reuben Farrelly
Modified: 2014-08-31 19:25 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-05-24 16:26:35 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Reuben Farrelly 2003-09-19 08:05:08 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 
particularly reliable...

Version-Release number of selected component (if applicable):

How reproducible:

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 
already running

Expected Results:  Squid should be able to be started and the pid file get 

Additional info:
Comment 1 Reuben Farrelly 2005-03-05 05:43:10 EST
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.
Comment 2 Jay Fenlason 2005-05-24 16:26:35 EDT
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. 
Comment 3 Reuben Farrelly 2005-05-24 23:53:48 EDT
Ditto, seems to be ok now.  I'm happy for this to stay closed.

Note You need to log in before you can comment on or make changes to this bug.