Subject: pkg/13706: Squid MUST shut down cleanly, no matter how long it takes!
To: None <gnats-bugs@gnats.netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: netbsd-bugs
Date: 08/13/2001 13:36:54
>Number:         13706
>Category:       pkg
>Synopsis:       Squid MUST shut down cleanly, no matter how long it takes!
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 13 11:48:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Greg A. Woods
>Release:        2001/08/13
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Environment:

>Description:

	You MUST allow squid to shutdown cleanly if you want it to run
	cleanly after reboot!!!!  Squid writes out its cache swap files
	and if those files are corrupt or incomplete more damage will be
	done than if they don't exist.  Indeed if they are corrupt or
	incomplete the entire cache filesystem may need re-creating!

	If squid does not shutdown cleanly in a timely fashion then
	there are any number of ways for a competent administrator to
	access the system again during the stuck shutdown and debug the
	problem; while an incompetent admin can do no more damage by
	simply powering off the system or manually resetting the
	hardware!  Indeed a hard power-off or reset is likely to be
	safer because it may trigger fsck into removing the corrupt or
	incomplete cache swap file(s)!

>How-To-Repeat:

	run a large squid that takes more than 20 seconds to shut itself
	down and face the consequences.

>Fix:

	The following change corrects the behaviour of etc/rc.d/squid so
	that it works as it must.  The time limit added in 1.10 should
	not ever have been added!  It was WRONG and will cause problems!

Index: files/squid.sh
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/www/squid/files/squid.sh,v
retrieving revision 1.10
diff -c -r1.10 squid.sh
*** files/squid.sh	2001/07/30 07:30:12	1.10
--- files/squid.sh	2001/08/13 17:28:24
***************
*** 34,51 ****
  		${kill_command}
  		if [ ${DAEMON_PID} -ne 0 ]; then
  			echo -n '['
! 			for WAIT in 0 1 2 3 4 5 6 7 8 9
! 			do
! 				if kill -0 ${DAEMON_PID} >/dev/null 2>&1; then
! 					sleep 2
! 					echo -n '.'
! 					test $WAIT -lt 9 || kill ${DAEMON_PID}
! 				else
! 					break
! 				fi
  			done
  			echo '].'
- 			unset WAIT
  		fi
  		unset DAEMON_PID
  	fi
--- 34,44 ----
  		${kill_command}
  		if [ ${DAEMON_PID} -ne 0 ]; then
  			echo -n '['
! 			while kill -0 ${DAEMON_PID} >/dev/null 2>&1; do
! 				sleep 2
! 				echo -n '.'
  			done
  			echo '].'
  		fi
  		unset DAEMON_PID
  	fi
>Release-Note:
>Audit-Trail:
>Unformatted: