Bug 24234 - Stopping squid sometimes result in an endless loop
Summary: Stopping squid sometimes result in an endless loop
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: squid   
(Show other bugs)
Version: 7.0
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2001-01-17 20:05 UTC by Jos Vos
Modified: 2014-03-17 02:18 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-01-17 20:32:27 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
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 20:26 UTC, Jos Vos
no flags Details | Diff

Description Jos Vos 2001-01-17 20:05:41 UTC
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

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

Maybe both solutions should be combined.  I'll attach a patch later.

Comment 1 Jos Vos 2001-01-17 20:26:36 UTC
Created attachment 7748 [details]
Patch for squid init script.

Comment 2 Jos Vos 2001-01-17 20:32:19 UTC
Justification for the changes made in the patch:

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).

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 18:53:48 UTC
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.