mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-03-14 03:22:06 +01:00
BUG/MINOR: mworker: only match worker processes when looking for unspawned proc
In master-worker mode, when a freshly forked worker looks up its own entry in proc_list to send its "READY" status to the master, the loop was breaking on the first process with pid == -1 regardless of its type. If a non-worker process (e.g. a master or program) also had pid == -1, the wrong entry could be selected, causing send_fd_uxst() to use an invalid ipc_fd. Fix this by adding a PROC_O_TYPE_WORKER check to the loop condition, and add a BUG_ON() assertion to catch any case where the loop exits without finding a valid worker entry. Must be backported to 3.1.
This commit is contained in:
parent
4e8cf26ab6
commit
d172f7b923
@ -3780,10 +3780,12 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
list_for_each_entry(proc, &proc_list, list) {
|
||||
if (proc->pid == -1)
|
||||
if (proc->pid == -1 && proc->options & PROC_O_TYPE_WORKER)
|
||||
break;
|
||||
}
|
||||
|
||||
BUG_ON(!(proc->options & PROC_O_TYPE_WORKER));
|
||||
|
||||
if (send_fd_uxst(proc->ipc_fd[1], sock_pair[0]) == -1) {
|
||||
ha_alert("[%s.main()] Cannot transfer connection fd %d over the sockpair@%d\n",
|
||||
argv[0], sock_pair[0], proc->ipc_fd[1]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user