stats admin can't work in multi-process mode because it can only
enable/disable servers of the same process. This tests check that the scoped
proxies are assigned to the same process and that only one is used.
--- src/cfgparse.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 65 insertions(+), 6 deletions(-) diff --git a/src/cfgparse.c b/src/cfgparse.c index 9d3e2fc..fd48da1 100644 --- a/src/cfgparse.cReceived on 2010/12/19 21:53
+++ b/src/cfgparse.c
@@ -6263,7 +6263,10 @@ out_uri_auth_compat: /* Check multi-process mode compatibility for the current proxy */ if (global.nbproc > 1) { - int nbproc = 0;
+ int nbproc, procmask;
+
+ nbproc = 0;
+ procmask = (1 << global.nbproc) - 1;
if (curproxy->bind_proc) { int proc; for (proc = 0; proc < global.nbproc; proc++) { @@ -6271,6 +6274,7 @@ out_uri_auth_compat: nbproc++; } }
+ procmask &= curproxy->bind_proc;
} else { nbproc = global.nbproc; } @@ -6279,14 +6283,69 @@ out_uri_auth_compat: curproxy->id); cfgerr++; }
+ if (curproxy->uri_auth && !LIST_ISEMPTY(&curproxy->uri_auth->admin_rules)) {
+ if (nbproc > 1) {
+ Warning("Proxy '%s': stats admin will not work correctly in multi-process mode.\n",
+ curproxy->id);
+ } else {
+ /* Even if this proxy is assigned to only one process,
+ * we must check the other ones to ensure they are also assigned to the same process.
+ */
+ struct proxy *px;
+ for (px = proxy; px; px = px->next) {
+ struct stat_scope *scope;
+ int nbproc2, procmask2;
+
+ if (curproxy->uri_auth->scope) {
+ int len;
+
+ len = strlen(px->id);
+ scope = curproxy->uri_auth->scope;
+ while (scope) {
+ /* match exact proxy name */
+ if (scope->px_len == len && !memcmp(px->id, scope->px_id, len))
+ goto px_scoped;
+
+ /* match '.' which means 'self' proxy */
+ if (!strcmp(scope->px_id, ".") && px == curproxy)
+ goto px_scoped;
+next_px_scope:
+ scope = scope->next;
+ }
+ continue;
+ }
+px_scoped:
+ nbproc2 = 0;
+ procmask2 = (1 << global.nbproc) - 1;
+ if (px->bind_proc) {
+ int proc;
+ for (proc = 0; proc < global.nbproc; proc++) {
+ if (px->bind_proc & (1 << proc)) {
+ nbproc2++;
+ }
+ }
+ procmask2 &= px->bind_proc;
+ } else {
+ nbproc2 = global.nbproc;
+ }
+ if (nbproc2 > 1) {
+ Warning("Proxy '%s': stats admin will not work correctly in multi-process mode because the proxy '%s' is enabled on several processes.\n",
+ curproxy->id, px->id);
+ } else if (procmask != procmask2) {
+ Warning("Proxy '%s': stats admin will not work correctly in multi-process mode because the proxy '%s' is not enabled on the same process.\n",
+ curproxy->id, px->id);
+ }
+
+ if (scope)
+ goto next_px_scope;
+ }
+ }
+ }
+ /* Check if the proxy is used by several processes */
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",
+ Warning("Proxy '%s': in multi-process mode, stats will be limited to the 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", -- 1.7.2.3
This archive was generated by hypermail 2.2.0 : 2010/12/19 22:00 CET