]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: mworker/cli: create master CLI sockpair before fork
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Thu, 3 Oct 2024 09:32:16 +0000 (11:32 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Oct 2024 20:02:39 +0000 (22:02 +0200)
commit6ec38c9a744fdba27961ceef16029402fff03697
treeecca3d58b4531f46036216076b3448f8054d18c7
parentcc1a631bebb74e06639220b652a79c01f30d2df2
MINOR: mworker/cli: create master CLI sockpair before fork

The main idea here is to create a master CLI inherited sockpair just before the
master-worker fork. And only then after the fork let each process to bind a
needed listener to the its end of this sockpair.

Like this master and worker processes can close unused "ends" of its sockpair
copy (ipc_fd[0] for worker and and ipc_fd[1] for master).

When this sockpair creation happens inside the
mworker_cli_global_proxy_new_listener() is not possible for the master to
close ipc_fd[1] bound to the GLOBAL proxy listener, as this triggers a
BUG_ON(fd->owner) in fd_insert() in master context, because master process
has alredy entered in its polling loop and poller in its turn tries to reused
closed fd.
src/cli.c
src/haproxy.c