]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MAJOR: config: Wrong maxconn adjustment.
authorFrédéric Lécaille <flecaille@haproxy.com>
Thu, 7 Mar 2019 14:02:52 +0000 (15:02 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 7 Mar 2019 16:07:23 +0000 (17:07 +0100)
Before c8d5b95 the "maxconn" of the backend of dynamic "use_backend"
rules was not modified (this does not make sense and this is correct).
When implementing proxy_adjust_all_maxconn(), c8d5b95 commit missed this case.
With this patch we adjust the "maxconn" of the backend of such rules only if
they are not dynamic.

Without this patch reg-tests/http-rules/h00003.vtc could make haproxy crash.

src/proxy.c

index e60b34a2181675598d544daf7cf935eab85de035..be810598ab639bc0f3988d74fe0d060503f57792 100644 (file)
@@ -1521,9 +1521,14 @@ void proxy_adjust_all_maxconn()
                         * the same backend or to the default backend.
                         */
                        if (swrule1->be.backend != curproxy->defbe.be) {
+                               /* note: swrule1->be.backend isn't a backend if the rule
+                                * is dynamic, it's an expression instead, so it must not
+                                * be dereferenced as a backend before being certain it is.
+                                */
                                list_for_each_entry(swrule2, &curproxy->switching_rules, list) {
                                        if (swrule2 == swrule1) {
-                                               swrule1->be.backend->tot_fe_maxconn += curproxy->maxconn;
+                                               if (!swrule1->dynamic)
+                                                       swrule1->be.backend->tot_fe_maxconn += curproxy->maxconn;
                                                break;
                                        }
                                        else if (!swrule2->dynamic && swrule2->be.backend == swrule1->be.backend) {