]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mworker/cli: reload fail with inherited FD
authorWilliam Lallemand <wlallemand@haproxy.com>
Fri, 18 Oct 2019 19:16:39 +0000 (21:16 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Fri, 18 Oct 2019 19:45:42 +0000 (21:45 +0200)
When using the master CLI with 'fd@', during a reload, the master CLI
proxy is stopped. Unfortunately if this is an inherited FD it is closed
too, and the master CLI won't be able to bind again during the
re-execution. It lead the master to fallback in waitpid mode.

This patch forbids the inherited FDs in the master's listeners to be
closed during a proxy_stop().

This patch is mandatory to use the -W option in VTest versions that contain the
-mcli feature.
(https://github.com/vtest/VTest/commit/86e65f1024453b1074d239a88330b5150d3e44bb)

Should be backported as far as 1.9.

src/proxy.c

index 6386812fb3b36fb599c431829da40fae4765c95c..ebc6415bd4c587cd3f20e664b9129dc0ee30dcbb 100644 (file)
@@ -1262,7 +1262,11 @@ void stop_proxy(struct proxy *p)
                        nostop = 1;
                        continue;
                }
-               unbind_listener(l);
+               /* The master should not close an inherited FD */
+               if (master && (l->options & LI_O_INHERITED))
+                       unbind_listener_no_close(l);
+               else
+                       unbind_listener(l);
                if (l->state >= LI_ASSIGNED) {
                        delete_listener(l);
                }