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.
continue;
LIST_DELETE(&child->list);
- close(child->ipc_fd[0]);
childfound = 1;
break;
}
/* check if exited child is a current child */
if (!(child->options & PROC_O_LEAVING)) {
if (child->options & PROC_O_TYPE_WORKER) {
+ fd_delete(child->ipc_fd[0]);
if (status < 128)
ha_warning("Current worker (%d) exited with code %d (%s)\n", exitpid, status, "Exit");
else
if (exitcode < 0 && status != 0 && status != 143)
exitcode = status;
} else {
+ fd_delete(child->ipc_fd[0]);
if (child->options & PROC_O_TYPE_WORKER) {
ha_warning("Former worker (%d) exited with code %d (%s)\n", exitpid, status, (status >= 128) ? strsignal(status - 128) : "Exit");
delete_oldpid(exitpid);