]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: config: report that "nbproc" is deprecated
authorWilly Tarreau <w@1wt.eu>
Tue, 20 Oct 2020 09:54:49 +0000 (11:54 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 20 Oct 2020 09:54:49 +0000 (11:54 +0200)
As previously discussed, nbproc usage is bad, deprecated, and scheduled
for removal in 2.5.

If "nbproc" is found with more than one process while nbthread is not
set, a warning will be emitted encouraging to remove it or to migrate
to nbthread instead. This makes sure the user has an opportunity to
both see the message and silence it.

doc/configuration.txt
src/haproxy.c

index b0edb963adc13529bd032a90b9671e7ae216ef05..bd9781cd1f5aad12435bfa71089bd4062091126e 100644 (file)
@@ -1176,14 +1176,15 @@ mworker-max-reloads <number>
   SIGTERM. This option helps to keep under control the number of workers.
   See also "show proc" in the Management Guide.
 
-nbproc <number>
+nbproc <number>  (deprecated)
   Creates <number> processes when going daemon. This requires the "daemon"
   mode. By default, only one process is created, which is the recommended mode
   of operation. For systems limited to small sets of file descriptors per
   process, it may be needed to fork multiple daemons. When set to a value
   larger than 1, threads are automatically disabled. USING MULTIPLE PROCESSES
-  IS HARDER TO DEBUG AND IS REALLY DISCOURAGED. See also "daemon" and
-  "nbthread".
+  IS HARDER TO DEBUG AND IS REALLY DISCOURAGED. This directive is deprecated
+  and scheduled for removal in 2.5. Please use "nbthread" instead. See also
+  "daemon" and "nbthread".
 
 nbthread <number>
   This setting is only available when support for threads was built in. It
index 389abb84ea0fd128a171aab4bf4a8befd24b9ba5..cc5cc1aeac4dab846c25a9e4ee048b0198908123 100644 (file)
@@ -1941,6 +1941,17 @@ static void init(int argc, char **argv)
                }
        }
 
+       if (global.nbproc > 1 && !global.nbthread) {
+               ha_warning("nbproc is deprecated!\n"
+                          "  | For suffering many limitations, the 'nbproc' directive is now deprecated\n"
+                          "  | and scheduled for removal in 2.5. Just comment it out: haproxy will use\n"
+                          "  | threads and will run on all allocated processors. You may also switch to\n"
+                          "  | 'nbthread %d' to keep the same number of processors. If you absolutely\n"
+                          "  | want to run in multi-process mode, you can silence this warning by adding\n"
+                          "  | 'nbthread 1', but then please report your use case to developers.\n",
+                          global.nbproc);
+       }
+
        err_code |= check_config_validity();
        for (px = proxies_list; px; px = px->next) {
                struct server *srv;