[squid-dev] [PATCH] shutdown sequence client connection handling

Kinkie gkinkie at gmail.com
Fri Jul 17 08:16:23 UTC 2015


Hi,
  LGTM;+1 (only request: turn
if (!getConcurrentRequestCount())
into
if (getConcurrentRequestCount() == 0)
to improve readability.

Good one!

On Fri, Jul 17, 2015 at 8:15 AM, Amos Jeffries <squid3 at treenet.co.nz> wrote:

> When Squid which are processing a lot of traffic, using persistent
> client connections, or dealing with long duration requests are shutdown
> they can exit with a lot of connections still open. The
> shutdown_lifetime directive exists to allow time for existing
> transactions to complete, but this is not always possible and has no
> effect on idle connections.
>
> The result is a large dump of aborted FD entries being logged as the TCP
> sockets get abruptly reset. Potentially active transactions cache
> objects being "corrupted" in the process.
>
>
> This makes ConnStateData and its children implement Runner API callbacks
> to receive signals about Squid shutdown. Which allows their close()
> handlers to be run properly and make use of AsyncCalls API. Idle client
> connections are closed immediately on the startShutdown() signal, so
> their closure CPU cycles happens during the shutdown grace period.
>
> An extra 0-delay event step is added to SignalEngine shutdown sequence
> with a new Runner registry hook 'endingShutdown' is added to signal that
> the shutdown_lifetime grace period is over for closure of active
> transactions. All network FD sockets should be considered unusable fro
> read()/write() at that point since close handlers may have already been
> scheduled by other Runners. AsyncCall's may still be scheduled to
> release resources.
>
> Also adds a DeregisterRunner() API action to remove Runners dynamically
> from the registered set.
>
> The Squid shutdown sequence is now:
>
> * shutdown signal received:
>  - listening sockets closed
>  - idle client connections closed
>
> * shutdown grace period ends:
>  - remaining client connections closed
>
> * shutdown finishes:
>  - main signal and Async loop halted
>  - all memory free'd
>
>
> Server connections which are PINNED or in active use during the
> endingShutdown execution will be closed cleanly as a side-effect of the
> client closures. Otherwise there is no change to server connections or
> other FD sockets behaviour on shutdown.
>
>
> Amos
>
> _______________________________________________
> squid-dev mailing list
> squid-dev at lists.squid-cache.org
> http://lists.squid-cache.org/listinfo/squid-dev
>
>


-- 
    Francesco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20150717/4d36877b/attachment-0001.html>


More information about the squid-dev mailing list