BUG/MINOR: systemd: potential zombie processes
In systemd mode (-Ds), the master haproxy process is waiting for each
child to exit in a specific order. If a process die when it's not his
turn, it will become a zombie process until every processes exit.
The master is now waiting for any process to exit in any order.
This patch should be backported to 1.7, 1.6 and 1.5.
(cherry picked from commit 1e4fc43630eb194f8e8dd98197cf47c7e9912371)
(cherry picked from commit 22e0a2295a96c30c9cd11e3aa5997e9de9083b93)
(cherry picked from commit 3cabb6e3d201aeb35216ef7b8d573c3e4f6b4398)
diff --git a/src/haproxy.c b/src/haproxy.c
index 15a40bc..53d9bec 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -1609,7 +1609,7 @@
if (global.mode & MODE_SYSTEMD) {
protocol_unbind_all();
for (proc = 0; proc < global.nbproc; proc++)
- while (waitpid(children[proc], NULL, 0) == -1 && errno == EINTR);
+ while (waitpid(-1, NULL, 0) == -1 && errno == EINTR);
}
exit(0); /* parent must leave */
}