]> git.proxmox.com Git - pve-common.git/commitdiff
daemon: don't send SIGTERM before restart on leave_children_open_on_reload
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 10 Nov 2017 11:09:27 +0000 (12:09 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 10 Nov 2017 11:14:20 +0000 (12:14 +0100)
Else this options is not really useful. First, sending a SIGTERM lets
the children exit, not quite what "leave_children_open_on_reload"
promises.

The problem this causes is that we may get a time window where no
worker is active and thus, for example, our API daemon would not
accept connections during a restart (or better said, reload).

So, don't request termination of any child worker, if this option is
set, but rather just restart (re-exec) ourself, startup a new set of
workers and only then request the termination of the old ones,
allowing a fully seamless reload.

This is only done on `$daemon-exe restart` and thus on
`systemctl reload $daemon`, systemctl restart or any other stop start
cycles always exit all other workers first.

This expects that the worker can do a graceful termination on
SIGTERM, which is already the case for anything using our AnyEvent
based class (which is base of our HTTPServer module).
With graceful termination is meant the following: the worker accepts
no new work and exits immediately after the current queued work is
done.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>

No differences found