Using haproxy in multi-process mode (nbproc > 1), some features can be
not fully compatible or not work at all. haproxy will now display a warning on
startup for :
- appsession
- sticking rules
- stats / stats admin
- stats socket
- peers (fatal error in that case)
---
 doc/configuration.txt |   41 ++++++++++++++++++++++++++++++++---------
 src/cfgparse.c        |   45 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 77 insertions(+), 9 deletions(-)

diff --git a/doc/configuration.txt b/doc/configuration.txt
index 88c4544..1a6fbcf 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -1142,11 +1142,15 @@ appsession <cookie> len <length> timeout <holdtime>
 
   The definition of an application cookie is limited to one per backend.
 
+  Note : Consider not using this feature in multi-process mode (nbproc > 1)
+         unless you know what you do : memory is not shared between the
+         processes, which can result in random behaviours.
+
   Example :
         appsession JSESSIONID len 52 timeout 3h
 
-  See also : "cookie", "capture cookie", "balance", "stick", "stick-table"
-             and "ignore-persist"
+  See also : "cookie", "capture cookie", "balance", "stick", "stick-table",
+             "ignore-persist", "nbproc" and "bind-process".
 
 
 backlog <conns>
@@ -4813,6 +4817,10 @@ stats admin { if | unless } <cond>
   The admin level allows to enable/disable servers from the web interface. By
   default, statistics page is read-only for security reasons.
 
+  Note : Consider not using this feature in multi-process mode (nbproc > 1)
+         unless you know what you do : memory is not shared between the
+         processes, which can result in random behaviours.
+
   Currently, there are 2 known limitations :
 
     - The POST data are limited to one packet, which means that if the list of
@@ -4849,8 +4857,9 @@ stats admin { if | unless } <cond>
         stats http-request auth unless AUTH
         stats admin if AUTH_ADMIN
 
-  See also : "stats enable", "stats auth", "stats http-request", section 3.4
-             about userlists and section 7 about ACL usage.
+  See also : "stats enable", "stats auth", "stats http-request", "nbproc",
+             "bind-process", section 3.4 about userlists and section 7 about
+             ACL usage.
 
 
 stats auth <user>:<passwd>
@@ -5291,6 +5300,10 @@ stick match <pattern> [table <table>] [{if | unless} 
<cond>]
   way, it becomes very easy to insert cookies and match on IP addresses in
   order to maintain stickiness between HTTP and HTTPS.
 
+  Note : Consider not using this feature in multi-process mode (nbproc > 1)
+         unless you know what you do : memory is not shared between the
+         processes, which can result in random behaviours.
+
   Example :
     # forward SMTP users to the same server they just used for POP in the
     # last 30 minutes
@@ -5309,8 +5322,8 @@ stick match <pattern> [table <table>] [{if | unless} 
<cond>]
         server s1 192.168.1.1:25
         server s2 192.168.1.1:25
 
-  See also : "stick-table", "stick on", and section 7 about ACLs and pattern
-             extraction.
+  See also : "stick-table", "stick on", "nbproc", "bind-process" and section 7
+             about ACLs and pattern extraction.
 
 
 stick on <pattern> [table <table>] [{if | unless} <condition>]
@@ -5323,6 +5336,10 @@ stick on <pattern> [table <table>] [{if | unless} 
<condition>]
          to both keywords for details. It is only provided as a convenience
          for writing more maintainable configurations.
 
+  Note : Consider not using this feature in multi-process mode (nbproc > 1)
+         unless you know what you do : memory is not shared between the
+         processes, which can result in random behaviours.
+
   Examples :
     # The following form ...
     stick on src table pop if !localhost
@@ -5350,7 +5367,7 @@ stick on <pattern> [table <table>] [{if | unless} 
<condition>]
         server s1 192.168.1.1:443
         server s2 192.168.1.1:443
 
-  See also : "stick match" and "stick store-request"
+  See also : "stick match", "stick store-request", "nbproc" and "bind-process".
 
 
 stick store-request <pattern> [table <table>] [{if | unless} <condition>]
@@ -5411,6 +5428,10 @@ stick store-request <pattern> [table <table>] [{if | 
unless} <condition>]
   established, so that the table will contain the real server that processed
   the request.
 
+  Note : Consider not using this feature in multi-process mode (nbproc > 1)
+         unless you know what you do : memory is not shared between the
+         processes, which can result in random behaviours.
+
   Example :
     # forward SMTP users to the same server they just used for POP in the
     # last 30 minutes
@@ -5429,8 +5450,8 @@ stick store-request <pattern> [table <table>] [{if | 
unless} <condition>]
         server s1 192.168.1.1:25
         server s2 192.168.1.1:25
 
-  See also : "stick-table", "stick on", and section 7 about ACLs and pattern
-             extraction.
+  See also : "stick-table", "stick on", "nbproc", "bind-process" and section 7
+             about ACLs and pattern extraction.
 
 
 stick-table type {ip | integer | string [len <length>] | binary [len <length>]}
@@ -5494,6 +5515,8 @@ stick-table type {ip | integer | string [len <length>] | 
binary [len <length>]}
                automatically learned from the local peer (old process) during a
                soft restart.
 
+               NOTE : peers can't be used in multi-process mode.
+
     <expire>   defines the maximum duration of an entry in the table since it
                was last created, refreshed or matched. The expiration delay is
                defined using the standard time format, similarly as the various
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 124e599..9d3e2fc 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -6261,9 +6261,54 @@ out_uri_auth_compat:
                        listener = listener->next;
                }
 
+               /* Check multi-process mode compatibility for the current proxy 
*/
+               if (global.nbproc > 1) {
+                       int nbproc = 0;
+                       if (curproxy->bind_proc) {
+                               int proc;
+                               for (proc = 0; proc < global.nbproc; proc++) {
+                                       if (curproxy->bind_proc & (1 << proc)) {
+                                               nbproc++;
+                                       }
+                               }
+                       } else {
+                               nbproc = global.nbproc;
+                       }
+                       if (curproxy->table.peers.name) {
+                               Alert("Proxy '%s': peers can't be used in 
multi-process mode (nbproc > 1).\n",
+                                       curproxy->id);
+                               cfgerr++;
+                       }
+                       if (nbproc > 1) {
+                               if (curproxy->uri_auth) {
+                                       Warning("Proxy '%s': in multi-process 
mode, stats will be limited to process assigned to the current request.\n",
+                                               curproxy->id);
+                                       if 
(!LIST_ISEMPTY(&curproxy->uri_auth->admin_rules)) {
+                                               Warning("Proxy '%s': stats 
admin will not work correctly in multi-process mode.\n",
+                                                       curproxy->id);
+                                       }
+                               }
+                               if (curproxy->appsession_name) {
+                                       Warning("Proxy '%s': appsession will 
not work correctly in multi-process mode.\n",
+                                               curproxy->id);
+                               }
+                               if (!LIST_ISEMPTY(&curproxy->sticking_rules)) {
+                                       Warning("Proxy '%s': sticking rules 
will not work correctly in multi-process mode.\n",
+                                               curproxy->id);
+                               }
+                       }
+               }
+               
                curproxy = curproxy->next;
        }
 
+       /* Check multi-process mode compatibility */
+       if (global.nbproc > 1) {
+               if (global.stats_fe) {
+                       Warning("stats socket will not work correctly in 
multi-process mode (nbproc > 1).\n");
+               }
+       }
+
        for (curuserlist = userlist; curuserlist; curuserlist = 
curuserlist->next) {
                struct auth_users *curuser;
                int g;
-- 
1.7.2.3


Reply via email to