Comment 9 for bug 1761096

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Sergio:
> "squid takes 30 seconds to restart regardless of dnsmasq/resolvconf (this is still true nowadays, with groovy)"

<snip>
I'm ashamed - it seems I have taken the most complex way to resolve a simple thing.
Imagine a very complex debugging through strace and gdb to reach a trivial config option - I removed the debugging section as it has no meaning
</snip>

The 30 seconds on squid are just the default config of it.
You can set any other value to get it's restart to be quicker (but also more rude to potential clients).

/etc/squid/squid.conf:
# TAG: shutdown_lifetime time-units
# When SIGTERM or SIGHUP is received, the cache is put into
# "shutdown pending" mode until all active sockets are closed.
# This value is the lifetime to set for all open descriptors
# during shutdown mode. Any active clients after this many
# seconds will receive a 'timeout' message.
#Default:
# shutdown_lifetime 30 seconds
shutdown_lifetime 5 seconds

So squid to shut down / restart in 30 seconds is normal/expected.

And reload command is
ExecReload=/bin/kill -HUP $MAINPID

MAINPID is the parent, this will make it not trigger the 30 sec on "systemctl reload" but only on "systemctl restart"

     CGroup: /system.slice/squid.service
             ├─4011 /usr/sbin/squid --foreground -sYC <-- gets HUP for reload
             ├─4013 (squid-1) --kid squid-1 --foreground -sYC
             ├─4014 (logfile-daemon) /var/log/squid/access.log
             └─4015 (pinger)

On reload is replaced with
     CGroup: /system.slice/squid.service
             ├─4011 /usr/sbin/squid --foreground -sYC
             ├─4013 (squid-1) --kid squid-1 --foreground -sYC
             ├─4024 (pinger)
             ├─4048 (logfile-daemon) /var/log/squid/access.log
             └─4049 (pinger)

And after the delay just one is left:
     CGroup: /system.slice/squid.service
             ├─4011 /usr/sbin/squid --foreground -sYC
             ├─4013 (squid-1) --kid squid-1 --foreground -sYC
             ├─4048 (logfile-daemon) /var/log/squid/access.log
             └─4049 (pinger)

So to summarize:
- squid shutdown/restart is intentionally slow to be graceful
- squid reload is fast