]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mworker: remain in mworker mode during reload
authorWilliam Lallemand <wlallemand@haproxy.com>
Tue, 14 Jan 2020 16:58:18 +0000 (17:58 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Tue, 14 Jan 2020 17:10:29 +0000 (18:10 +0100)
If you reload an haproxy started in master-worker mode with
"master-worker" in the configuration, and no "-W" argument,
the new process lost the fact that is was in master-worker mode
resulting in weird behaviors.

The bigest problem is that if it is reloaded with an bad configuration,
the master will exits instead of remaining in waitpid mode.

This problem was discovered in bug #443.

Should be backported in every version using the master-worker mode.
(as far as 1.8)

src/haproxy.c

index 30c43c11ba8532baef9f453e5f175b237e5e1e1c..05268e1e7ea4e1d1f62399ec04a629d64b2cae5b 100644 (file)
@@ -1496,6 +1496,10 @@ static void init(int argc, char **argv)
        memcpy(localpeer, hostname, (sizeof(hostname) > sizeof(localpeer) ? sizeof(localpeer) : sizeof(hostname)) - 1);
        setenv("HAPROXY_LOCALPEER", localpeer, 1);
 
+       /* we were in mworker mode, we should restart in mworker mode */
+       if (getenv("HAPROXY_MWORKER_REEXEC") != NULL)
+               global.mode |= MODE_MWORKER;
+
        /*
         * Initialize the previously static variables.
         */