]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: error: simplify startup_logs_init_shm
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Mon, 21 Oct 2024 15:10:18 +0000 (17:10 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Thu, 24 Oct 2024 09:32:20 +0000 (11:32 +0200)
commit5ee266b745e539e5c21bc093d1dd8353881f22ce
treecd6ab949faac22b6546599e0ced3654c6048db71
parente9c8e0efc9e7c4c7e6bbbe61e7963baa6f71f8c8
MINOR: error: simplify startup_logs_init_shm

This patch simplifies the code of startup_logs_init_shm(). We no longer re-exec
master process twice after each reload to free its unused memory, which it had
to allocate, because it has parsed all configuration sections. So, there is no
longer need to keep SHM fd opened between the first and the next reloads. We
can completely remove HAPROXY_STARTUPLOGS_FD.

In step_init_1() we continue to call startup_logs_init_shm() to open SHM and to
allocate startup logs ring area within it. In master-worker mode, worker
duplicates initial startup logs ring after sending its READY state to master.
Sharing the same ring between two processes until the worker finishes its
initialization allows to show at master CLI output worker's startup logs.

During the next reload master process should free the memory allocated for the
ring structure. Then after the execvp() it will reopen and map SHM area again
and it will reallocate again the ring structure.
src/errors.c
src/haproxy.c
src/mworker-prog.c