]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: systemd: potential zombie processes
authorWilliam Lallemand <wlallemand@haproxy.com>
Fri, 23 Dec 2016 14:44:15 +0000 (15:44 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 23 Dec 2016 15:21:48 +0000 (16:21 +0100)
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.

src/haproxy.c

index bb9f0cf9f02a560ae0885eba5f14b931d8f263a7..4ad370d655031417acadba2b9bcea9b490bb476e 100644 (file)
@@ -1898,7 +1898,7 @@ int main(int argc, char **argv)
                                /* it's OK because "-Ds -f x" is the shortest form going here */
                                memcpy(argv[0] + strlen(argv[0]), "-master", 8);
                                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 */
                }