Bug 24234 - Stopping squid sometimes result in an endless loop
Stopping squid sometimes result in an endless loop
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: squid (Show other bugs)
7.0
All Linux
medium Severity high
: ---
: ---
Assigned To: Bill Nottingham
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-01-17 15:05 EST by Jos Vos
Modified: 2014-03-16 22:18 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-01-17 15:32:27 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch for squid init script. (913 bytes, patch)
2001-01-17 15:26 EST, Jos Vos
no flags Details | Diff

  None (edit)
Description Jos Vos 2001-01-17 15:05:41 EST
When squid died abnormally (or was killed with -9 or so) and left a pid
file in /var/run, running "/etc/rc.d/init.d/squid stop" will result in an
endless loop. The squid stop() routine checks $? after running "$SQUID -k
shutdown &", but this will always give 0, because the process was started
in the background.

Given the wish to give some output while waiting for the shutdown, a
counter can be included to let the loop only be passed a finite number of
times.

Another possibility is to first do a "squid -k check" synchronously, but
this still leaves some room for an endless loop (at least as a race
condition). 

Maybe both solutions should be combined.  I'll attach a patch later.
Comment 1 Jos Vos 2001-01-17 15:26:36 EST
Created attachment 7748 [details]
Patch for squid init script.
Comment 2 Jos Vos 2001-01-17 15:32:19 EST
Justification for the changes made in the patch:

(1)
The "-k check" is included to catch most cases, when squid is just not running
anymore and the pid file still exists for some reason (e.g. kill -9).

(2)
The time counter is included, in case a squid process exists (assuming -k check
works reliable), but won't shutdown for some reason.  The timeout can be fairly
long, as this will only happen in very rare cases (if ever), but it's still
better than having to push the reset button :-).
Comment 3 Bill Nottingham 2001-01-19 13:53:48 EST
Will be fixed in 2.3.STABLE4-7. The variable will be set from the
new /etc/sysconfig/squid, however - thanks for the patch.

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