]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: mworker: mworker_catch_sigchld: use fd_delete instead of close
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Fri, 4 Oct 2024 08:59:06 +0000 (10:59 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Oct 2024 20:02:39 +0000 (22:02 +0200)
commit9b27f82da3cc406dd3935cb106802c2fa4f5ba9e
tree9d71edfe288c127c9d6122a5119445662a4fc7d6
parentcf150fd73d5ee139d07e5200d4ddef4ebc33a6e2
MINOR: mworker: mworker_catch_sigchld: use fd_delete instead of close

If the worker exits due to failure or due to receiving TERM signal, in the
master context, we can't now simply close the master's fd (ipc_fd[0]) of
the inherited master CLI sockpair.

When the worker is created, in the master process context MASTER proxy listener
is bound to ipc_fd[0]. When this worker fails or exits, master process is
always in its polling loop. So, closing some fd in its context immediately
triggers the BUG_ON(fd->owner), as the poller try to reinsert the "freed" fd
into fdtab and try to reuse it. We must call fd_delete in this case. This will
deinitializes fd auxilary data and closes its properly.
src/mworker.c