]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: mworker: add support for case when new worker dies
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Wed, 9 Oct 2024 13:44:43 +0000 (15:44 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Oct 2024 20:02:39 +0000 (22:02 +0200)
commitc8aac63893e2b96f51e74d0af69a6760b9874cfe
tree27c9c4bed7a846c01b0bd1736e3e8a74e71713df
parent2bb07b913d09790172858b0491130bb517c75734
MINOR: mworker: add support for case when new worker dies

The case, when the new worker fails while it parses its configuration or while
it tries to apply it, could be considered as the new one, because the master
process is no longer need to reexec again. The master simply keeps the previous
worker (forked before the reload) and it let the new one to exit with failure.

When the new worker exits, in the master process context (mworker_catch_sigchld)
we need to stop a MASTER proxy listener and we need to drop the server,
attached to new worker's CLI sockpair (it's inherited in master). Then we
explicitly delete master's end of this sockpair (child->ipc_fd[0]) from the
fdtab and we free the memory allocated for the worker process.
on_new_child_failure() is called before the clean up to signal systemd that
reload/load was failed.

If the new worker fails during the first start, so there is no any previous
worker, master process should exit immediately in order to keep the same
behaviour, as it was before this architecture change.
src/mworker.c