]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: mworker: slow load status delivery if worker is starting
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Tue, 15 Oct 2024 08:45:35 +0000 (10:45 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Oct 2024 20:02:39 +0000 (22:02 +0200)
commitd766677d9217b2677ce1cb02391358da5d07a7a2
tree14a07384ca2b85ba2deccc2b2c9d1072a6866113
parent5f164530825111219ae79b87df047808e36f4830
MINOR: mworker: slow load status delivery if worker is starting

With refactored master-worker architecture master and worker processes parse
its parts of the configuration. Worker could have a huge configuration, so it
will take some time to load. As now HAPROXY_LOAD_SUCCESS is set to 1 only
after receiving the status READY from the new worker
cli_io_handler_show_loadstatus() may exit very fast by showing load status 0,
and in such case and mcli socket will be closed.

This already breaks some regression tests and can confuse some APIs. So, let's
slow down the load status delivery. If in the process list there is still some
process, which is loading (PROC_O_INIT). appctx task will sleep in this case for
50ms and then return 0. cli_io_handler_show_loadstatus() is called in loop, so
with such pacing, there is a high chance that the next time, when we enter in
its scope all processes will have the state READY. Like this master CLI
connection socket won't be closed until the loading of the new worker is really
finished, thus the reload status and logs (Success=1/0) will be shown in
synchronious way.
src/mworker.c