Search squid archive

Re: Error restarting squid from RPM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/20/2014 08:46 AM, fernando@xxxxxxxxxxxxx wrote:
> Hi,
> 
> I don't know if this affects only the RPM packaging or squid sources. I'm
> using Eliezer packages for CentOS 6, namely 3.4.3-1.el6.x86)64.
> 
> The issue is that sometimes "service squid restart" leaves old squid
> processes running alongside newer ones. I have to "killall squid" and start
> again to have a working proxy.
> 
> I see "squid -k shutdown" does not wait for all squid kids to stop, and
> this makes init.d/squid to leave such broken restart.
> 
> I coud just increate SQUID_SHUTDOWN_TIMEOUT at /etc/sysconfig/squid so the
> init.d/squid script wait a little longer, but i think the restart command
> should be more robust. So I propose the following simple change to the
> init.d/squid script:
> 
> ---------------
> 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
> }
> ---------------
> 
> Instead of blindly calling start after stop, check if the stop function
> returned ok or an error status code.
> 
> I think it's better having restart fail sometimes than having broken squid
> processes after restart.
> 
> []s, Fernando Lozano
> 

The problem as I see it is there needs to be timeout (or a wait) between
stop and start in restart.

The stop branch returns immediately and then executes the start branch
which sees the pid file (since the controlling squid is waiting for the
children to complete their processes) and claims squid already running
and exits.

So when the controlling squid finally stops and removes the pid file the
start branch has already exited and the server doesn't restart.

I'm not an expert on squid but I would not recommend removing the pid
file before squid controller has exited.

If it never stops then you have different problem.







[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux