Bug 104698 - Init script not too smart if squid dies without being shut down properly
Summary: Init script not too smart if squid dies without being shut down properly
Alias: None
Product: Fedora
Classification: Fedora
Component: squid (Show other bugs)
(Show other bugs)
Version: rawhide
Hardware: All Linux
Target Milestone: ---
Assignee: Jay Fenlason
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2003-09-19 12:05 UTC by Reuben Farrelly
Modified: 2014-08-31 23:25 UTC (History)
1 user (show)

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

Attachments (Terms of Use)

Description Reuben Farrelly 2003-09-19 12:05:08 UTC
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 10:43:10 UTC
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 20:26:35 UTC
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-25 03:53:48 UTC
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.