]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mworker: use default maxconn in wait mode
authorWilliam Lallemand <wlallemand@haproxy.org>
Tue, 21 Jun 2022 09:11:50 +0000 (11:11 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Tue, 21 Jun 2022 12:22:49 +0000 (14:22 +0200)
In bug #1751, it was reported that haproxy is consumming too much memory
since the 2.4 version. This is because of a change in the master, which
loses completely its configuration in wait mode, and lose its maxconn.

Without the maxconn, haproxy will try to compute one itself, and will
allocate RAM consequently, too much in our case. Which means the master
will have a too high maxconn and too much RAM allocated.

The patch fixes the issue by setting the maxconn to the default value
when re-executing the master in wait mode.

Must be backported as far as 2.5.

src/haproxy.c

index 32eb4bdc6a131dc94be5c27cf147d0d38d532eea..892d821944880b3b16cf30df205a0aa4b22d5a9e 100644 (file)
@@ -2244,6 +2244,10 @@ static void init(int argc, char **argv)
                        exit(1);
        }
 
+       /* set the default maxconn in the master, but let it be rewritable with -n */
+       if (global.mode & MODE_MWORKER_WAIT)
+               global.maxconn = DEFAULT_MAXCONN;
+
        if (cfg_maxconn > 0)
                global.maxconn = cfg_maxconn;