Bug 1099577 - service squid restart sometimes leaves duplicate processes
Summary: service squid restart sometimes leaves duplicate processes
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: squid
Version: 20
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Michal Luscon
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-05-20 15:56 UTC by Fernando Lozano
Modified: 2014-05-28 09:13 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-05-28 09:13:19 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Fernando Lozano 2014-05-20 15:56:50 UTC
Description of problem:
Sometimes restarting squid leaves old processes running for a short while at the same times as new processes, and so the new processes won't start fine, forcing me to killall squid and start anew.

Version-Release number of selected component (if applicable):
3.3.x/3.4.x

How reproducible:
You have to be (un)lucky. The time to stop squid varies a lot, and the problem only happens if it takes longer than SQUID_SHUTDOWN_TIMEOUT defined in /etc/sysconfig/squid

Steps to Reproduce:
1. service squid restart

Actual results:
squid won't proxy http requests

Expected results:
squid working as usual

Additional info:
I tested this in CentOS 6.5 and using an unofficial RPM package from squid-cache.org. But I checked the squid RPM packates for Fedora and CentOS and the init.d script is the same, so the problem should affect at least RHEL6. I'm not sure this will affect Fedora 19/20 with systemd or RHEL7.

I think it's better having service squid restart failling than leaving a broken squid, so I propose the following change to /etc/init.d/squid:

------------
restart() {
	stop
	RETVAL=$?
	if [ $RETVAL -eq 0 ] ; then
		rm -rf $SQUID_PIDFILE_DIR/*
		start
	else
		echo "Failure stopping squid or stopping squid took too long. Please check before restarting."
		return 1
        fi
}
-------------

Now the restart() function, instead of blindly calling start() after stop(), it checks the return code from stop(). If stop() timeouts, it returns an error code and so restart() refuses to call start() aftewards.

This little change makes squid more robust for sysadmins who still have to use init.d scripts.

Increasing SQUID_SHUTDOWN_TIMEOUT reduces the frequence of restart failing, but doesn't guarantees success.

Comment 1 Pavel Šimerda (pavlix) 2014-05-21 10:39:15 UTC
The bug report is filed for Fedora 20 and refers to the initscripts which are not even shipped by default. Shouldn't we just remove the squid-sysvinit package where the initscript resides?

Comment 2 Fernando Lozano 2014-05-21 14:07:46 UTC
Pavel, you are right about Fedora, but Fedora packages are upstream for CentOS 6 and RHEL 6 packages that do use the init files and would benefit from the proposed change. Maybe this bug should be moved to another product or release.

Comment 3 Pavel Šimerda (pavlix) 2014-05-22 08:14:48 UTC
(In reply to Fernando Lozano from comment #2)
> Pavel, you are right about Fedora, but Fedora packages are upstream for
> CentOS 6 and RHEL 6 packages that do use the init files and would benefit
> from the proposed change.

This is not how things work. Released versions RHEL/CentOS aren't typically pulling in packages from later Fedora releases.

> Maybe this bug should be moved to another product or release.

Please start new bugs with the respective projects you are interested in.

I would like to keep this bug open for the question of removing the initscript entirely as it has essentially no value for Fedora. Any ideas?

Comment 4 Fernando Lozano 2014-05-26 20:55:16 UTC
I think you're right. Initscripts should be removed from Fedora packages when they support systemd directly.

Comment 5 Michal Luscon 2014-05-28 09:13:19 UTC
I have just removed sysvinit subpackage from rawhide.


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