Blame SOURCES/071-cluster-ipc-limit.patch

139d2d
From ae780515cd4db1e6f23db9f75a628ce9c39bdd49 Mon Sep 17 00:00:00 2001
139d2d
From: Ken Gaillot <kgaillot@redhat.com>
139d2d
Date: Fri, 9 Jun 2017 12:35:36 -0500
139d2d
Subject: [PATCH 1/8] Refactor: libcrmcommon: remember when IPC client is root
139d2d
 or cluster user
139d2d
139d2d
will allow using a different eviction threshold
139d2d
---
139d2d
 include/crm/common/ipcs.h |  3 ++-
139d2d
 lib/common/ipc.c          | 13 ++++++++++---
139d2d
 2 files changed, 12 insertions(+), 4 deletions(-)
139d2d
139d2d
diff --git a/include/crm/common/ipcs.h b/include/crm/common/ipcs.h
139d2d
index 52338e3..43b7b60 100644
139d2d
--- a/include/crm/common/ipcs.h
139d2d
+++ b/include/crm/common/ipcs.h
139d2d
@@ -60,7 +60,8 @@ struct crm_remote_s {
139d2d
 
139d2d
 enum crm_client_flags
139d2d
 {
139d2d
-    crm_client_flag_ipc_proxied = 0x00001, /* ipc_proxy code only */
139d2d
+    crm_client_flag_ipc_proxied    = 0x00001, /* ipc_proxy code only */
139d2d
+    crm_client_flag_ipc_privileged = 0x00002, /* root or cluster user */
139d2d
 };
139d2d
 
139d2d
 struct crm_client_s {
139d2d
diff --git a/lib/common/ipc.c b/lib/common/ipc.c
139d2d
index 50980ec..e0a7a5c 100644
139d2d
--- a/lib/common/ipc.c
139d2d
+++ b/lib/common/ipc.c
139d2d
@@ -314,6 +314,7 @@ crm_client_alloc(void *key)
139d2d
 crm_client_t *
139d2d
 crm_client_new(qb_ipcs_connection_t * c, uid_t uid_client, gid_t gid_client)
139d2d
 {
139d2d
+    static gid_t uid_cluster = 0;
139d2d
     static gid_t gid_cluster = 0;
139d2d
 
139d2d
     crm_client_t *client = NULL;
139d2d
@@ -323,11 +324,12 @@ crm_client_new(qb_ipcs_connection_t * c, uid_t uid_client, gid_t gid_client)
139d2d
         return NULL;
139d2d
     }
139d2d
 
139d2d
-    if (gid_cluster == 0) {
139d2d
-        if(crm_user_lookup(CRM_DAEMON_USER, NULL, &gid_cluster) < 0) {
139d2d
+    if (uid_cluster == 0) {
139d2d
+        if (crm_user_lookup(CRM_DAEMON_USER, &uid_cluster, &gid_cluster) < 0) {
139d2d
             static bool have_error = FALSE;
139d2d
             if(have_error == FALSE) {
139d2d
-                crm_warn("Could not find group for user %s", CRM_DAEMON_USER);
139d2d
+                crm_warn("Could not find user and group IDs for user %s",
139d2d
+                         CRM_DAEMON_USER);
139d2d
                 have_error = TRUE;
139d2d
             }
139d2d
         }
139d2d
@@ -347,6 +349,11 @@ crm_client_new(qb_ipcs_connection_t * c, uid_t uid_client, gid_t gid_client)
139d2d
     client->kind = CRM_CLIENT_IPC;
139d2d
     client->pid = crm_ipcs_client_pid(c);
139d2d
 
139d2d
+    if ((uid_client == 0) || (uid_client == uid_cluster)) {
139d2d
+        /* Remember when a connection came from root or hacluster */
139d2d
+        set_bit(client->flags, crm_client_flag_ipc_privileged);
139d2d
+    }
139d2d
+
139d2d
     crm_debug("Connecting %p for uid=%d gid=%d pid=%u id=%s", c, uid_client, gid_client, client->pid, client->id);
139d2d
 
139d2d
 #if ENABLE_ACL
139d2d
-- 
139d2d
1.8.3.1
139d2d
139d2d
139d2d
From f93ce6bdd6be5d2670ab0cd8dd10d3b8b9972a65 Mon Sep 17 00:00:00 2001
139d2d
From: Ken Gaillot <kgaillot@redhat.com>
139d2d
Date: Fri, 9 Jun 2017 14:46:16 -0500
139d2d
Subject: [PATCH 2/8] Low: libcrmcommon: add function for testing daemon name
139d2d
139d2d
---
139d2d
 include/crm/common/util.h |  2 ++
139d2d
 lib/common/utils.c        | 21 +++++++++++++++++++++
139d2d
 2 files changed, 23 insertions(+)
139d2d
139d2d
diff --git a/include/crm/common/util.h b/include/crm/common/util.h
139d2d
index 682b346..aa192f9 100644
139d2d
--- a/include/crm/common/util.h
139d2d
+++ b/include/crm/common/util.h
139d2d
@@ -26,6 +26,7 @@
139d2d
 
139d2d
 #  include <sys/types.h>
139d2d
 #  include <stdlib.h>
139d2d
+#  include <stdbool.h>
139d2d
 #  include <limits.h>
139d2d
 #  include <signal.h>
139d2d
 #  include <sysexits.h>
139d2d
@@ -127,6 +128,7 @@ gboolean did_rsc_op_fail(lrmd_event_data_t * event, int target_rc);
139d2d
 char *crm_md5sum(const char *buffer);
139d2d
 
139d2d
 char *crm_generate_uuid(void);
139d2d
+bool crm_is_daemon_name(const char *name);
139d2d
 
139d2d
 int crm_user_lookup(const char *name, uid_t * uid, gid_t * gid);
139d2d
 
139d2d
diff --git a/lib/common/utils.c b/lib/common/utils.c
139d2d
index 27ed60d..a652197 100644
139d2d
--- a/lib/common/utils.c
139d2d
+++ b/lib/common/utils.c
139d2d
@@ -1959,6 +1959,27 @@ crm_generate_uuid(void)
139d2d
     return buffer;
139d2d
 }
139d2d
 
139d2d
+/*!
139d2d
+ * \brief Check whether a string represents a cluster daemon name
139d2d
+ *
139d2d
+ * \param[in] name  String to check
139d2d
+ *
139d2d
+ * \return TRUE if name is standard client name used by daemons, FALSE otherwise
139d2d
+ */
139d2d
+bool
139d2d
+crm_is_daemon_name(const char *name)
139d2d
+{
139d2d
+    return (name &&
139d2d
+            (!strcmp(name, CRM_SYSTEM_CRMD)
139d2d
+            || !strcmp(name, CRM_SYSTEM_STONITHD)
139d2d
+            || !strcmp(name, T_ATTRD)
139d2d
+            || !strcmp(name, CRM_SYSTEM_CIB)
139d2d
+            || !strcmp(name, CRM_SYSTEM_MCP)
139d2d
+            || !strcmp(name, CRM_SYSTEM_DC)
139d2d
+            || !strcmp(name, CRM_SYSTEM_TENGINE)
139d2d
+            || !strcmp(name, CRM_SYSTEM_LRMD)));
139d2d
+}
139d2d
+
139d2d
 #include <md5.h>
139d2d
 
139d2d
 char *
139d2d
-- 
139d2d
1.8.3.1
139d2d
139d2d
139d2d
From 19497fa9785c854084253167b7dc54a8c026e1ad Mon Sep 17 00:00:00 2001
139d2d
From: Ken Gaillot <kgaillot@redhat.com>
139d2d
Date: Fri, 9 Jun 2017 11:11:50 -0500
139d2d
Subject: [PATCH 3/8] Low: libcrmcommon: support setting max queue length per
139d2d
 IPC client
139d2d
139d2d
---
139d2d
 include/crm/common/ipcs.h |  3 +++
139d2d
 lib/common/ipc.c          | 39 ++++++++++++++++++++++++++-------------
139d2d
 2 files changed, 29 insertions(+), 13 deletions(-)
139d2d
139d2d
diff --git a/include/crm/common/ipcs.h b/include/crm/common/ipcs.h
139d2d
index 43b7b60..d2db212 100644
139d2d
--- a/include/crm/common/ipcs.h
139d2d
+++ b/include/crm/common/ipcs.h
139d2d
@@ -19,6 +19,7 @@
139d2d
 #ifndef CRM_COMMON_IPCS__H
139d2d
 #  define CRM_COMMON_IPCS__H
139d2d
 
139d2d
+#  include <stdbool.h>
139d2d
 #  include <qb/qbipcs.h>
139d2d
 #  ifdef HAVE_GNUTLS_GNUTLS_H
139d2d
 #    undef KEYFILE
139d2d
@@ -95,6 +96,7 @@ struct crm_client_s {
139d2d
     struct crm_remote_s *remote;        /* TCP/TLS */
139d2d
 
139d2d
     unsigned int queue_backlog; /* IPC queue length after last flush */
139d2d
+    unsigned int queue_max;     /* Evict client whose queue grows this big */
139d2d
 };
139d2d
 
139d2d
 extern GHashTable *client_connections;
139d2d
@@ -110,6 +112,7 @@ crm_client_t *crm_client_alloc(void *key);
139d2d
 crm_client_t *crm_client_new(qb_ipcs_connection_t * c, uid_t uid, gid_t gid);
139d2d
 void crm_client_destroy(crm_client_t * c);
139d2d
 void crm_client_disconnect_all(qb_ipcs_service_t *s);
139d2d
+bool crm_set_client_queue_max(crm_client_t *client, const char *qmax);
139d2d
 
139d2d
 void crm_ipcs_send_ack(crm_client_t * c, uint32_t request, uint32_t flags,
139d2d
                        const char *tag, const char *function, int line);
139d2d
diff --git a/lib/common/ipc.c b/lib/common/ipc.c
139d2d
index e0a7a5c..3110334 100644
139d2d
--- a/lib/common/ipc.c
139d2d
+++ b/lib/common/ipc.c
139d2d
@@ -37,8 +37,9 @@
139d2d
 
139d2d
 #define PCMK_IPC_VERSION 1
139d2d
 
139d2d
-/* Evict clients whose event queue grows this large */
139d2d
-#define PCMK_IPC_MAX_QUEUE 500
139d2d
+/* Evict clients whose event queue grows this large (by default) */
139d2d
+#define PCMK_IPC_DEFAULT_QUEUE_MAX 500
139d2d
+#define PCMK_IPC_DEFAULT_QUEUE_MAX_S "500"
139d2d
 
139d2d
 struct crm_ipc_response_header {
139d2d
     struct qb_ipc_response_header qb;
139d2d
@@ -409,6 +410,24 @@ crm_client_destroy(crm_client_t * c)
139d2d
     free(c);
139d2d
 }
139d2d
 
139d2d
+/*!
139d2d
+ * \brief Raise IPC eviction threshold for a client, if allowed
139d2d
+ *
139d2d
+ * \param[in,out] client     Client to modify
139d2d
+ * \param[in]     queue_max  New threshold (as string)
139d2d
+ *
139d2d
+ * \return TRUE if change was allowed, FALSE otherwise
139d2d
+ */
139d2d
+bool
139d2d
+crm_set_client_queue_max(crm_client_t *client, const char *qmax)
139d2d
+{
139d2d
+    if (is_set(client->flags, crm_client_flag_ipc_privileged)) {
139d2d
+        client->queue_max = crm_parse_int(qmax, PCMK_IPC_DEFAULT_QUEUE_MAX_S);
139d2d
+        return TRUE;
139d2d
+    }
139d2d
+    return FALSE;
139d2d
+}
139d2d
+
139d2d
 int
139d2d
 crm_ipcs_client_pid(qb_ipcs_connection_t * c)
139d2d
 {
139d2d
@@ -553,18 +572,12 @@ crm_ipcs_flush_events(crm_client_t * c)
139d2d
     }
139d2d
 
139d2d
     if (queue_len) {
139d2d
-        /* We want to allow clients to briefly fall behind on processing
139d2d
-         * incoming messages, but drop completely unresponsive clients so the
139d2d
-         * connection doesn't consume resources indefinitely.
139d2d
-         *
139d2d
-         * @TODO It is possible that the queue could reasonably grow large in a
139d2d
-         * short time. An example is a reprobe of hundreds of resources on many
139d2d
-         * nodes resulting in a surge of CIB replies to the crmd. We could
139d2d
-         * possibly give cluster daemons a higher threshold here, and/or prevent
139d2d
-         * such a surge by throttling LRM history writes in the crmd.
139d2d
-         */
139d2d
 
139d2d
-        if (queue_len > PCMK_IPC_MAX_QUEUE) {
139d2d
+        /* Allow clients to briefly fall behind on processing incoming messages,
139d2d
+         * but drop completely unresponsive clients so the connection doesn't
139d2d
+         * consume resources indefinitely.
139d2d
+         */
139d2d
+        if (queue_len > QB_MAX(c->queue_max, PCMK_IPC_DEFAULT_QUEUE_MAX)) {
139d2d
             if ((c->queue_backlog <= 1) || (queue_len < c->queue_backlog)) {
139d2d
                 /* Don't evict for a new or shrinking backlog */
139d2d
                 crm_warn("Client with process ID %u has a backlog of %u messages "
139d2d
-- 
139d2d
1.8.3.1
139d2d
139d2d
139d2d
From 324e241d9d9666dfe6543ddf88d965b12d5a164f Mon Sep 17 00:00:00 2001
139d2d
From: Ken Gaillot <kgaillot@redhat.com>
139d2d
Date: Mon, 12 Jun 2017 17:47:12 -0500
139d2d
Subject: [PATCH 4/8] Low: libcib: always use current values when unpacking
139d2d
 config
139d2d
139d2d
Previously, cib_read_config() called unpack_instance_attributes() with
139d2d
overwrite=FALSE. This meant that changes to an option would not take effect
139d2d
unless the option was not set before.
139d2d
139d2d
The only significant use of cib_read_config() was in cib_acl_enabled(), which
139d2d
used a new, empty hash table for every call, so the issue didn't matter.
139d2d
139d2d
The cib daemon also used cib_read_config() to maintain a global config_hash,
139d2d
which was affected by the issue, but didn't matter because it was never used.
139d2d
This change will allow config_hash to be used.
139d2d
---
139d2d
 lib/cib/cib_utils.c | 2 +-
139d2d
 1 file changed, 1 insertion(+), 1 deletion(-)
139d2d
139d2d
diff --git a/lib/cib/cib_utils.c b/lib/cib/cib_utils.c
139d2d
index ab48f16..8aeed67 100644
139d2d
--- a/lib/cib/cib_utils.c
139d2d
+++ b/lib/cib/cib_utils.c
139d2d
@@ -743,7 +743,7 @@ cib_read_config(GHashTable * options, xmlNode * current_cib)
139d2d
     config = get_object_root(XML_CIB_TAG_CRMCONFIG, current_cib);
139d2d
     if (config) {
139d2d
         unpack_instance_attributes(current_cib, config, XML_CIB_TAG_PROPSET, NULL, options,
139d2d
-                                   CIB_OPTIONS_FIRST, FALSE, now);
139d2d
+                                   CIB_OPTIONS_FIRST, TRUE, now);
139d2d
     }
139d2d
 
139d2d
     verify_cib_options(options);
139d2d
-- 
139d2d
1.8.3.1
139d2d
139d2d
139d2d
From b986acbe131216aaa372681e97dfc0f2ef8f70ad Mon Sep 17 00:00:00 2001
139d2d
From: Ken Gaillot <kgaillot@redhat.com>
139d2d
Date: Tue, 13 Jun 2017 16:03:36 -0500
139d2d
Subject: [PATCH 5/8] Low: libcib: correctly search for v2 patchset changes
139d2d
139d2d
cib_internal_config_changed() was never updated for v2 patch format
139d2d
---
139d2d
 lib/cib/cib_utils.c | 23 ++++++++++++-----------
139d2d
 1 file changed, 12 insertions(+), 11 deletions(-)
139d2d
139d2d
diff --git a/lib/cib/cib_utils.c b/lib/cib/cib_utils.c
139d2d
index 8aeed67..f639ada 100644
139d2d
--- a/lib/cib/cib_utils.c
139d2d
+++ b/lib/cib/cib_utils.c
139d2d
@@ -794,23 +794,24 @@ cib_apply_patch_event(xmlNode * event, xmlNode * input, xmlNode ** output, int l
139d2d
     return rc;
139d2d
 }
139d2d
 
139d2d
+/* v2 and v2 patch formats */
139d2d
+#define XPATH_CONFIG_CHANGE \
139d2d
+    "//" XML_CIB_TAG_CRMCONFIG " | " \
139d2d
+    "//" XML_DIFF_CHANGE "[contains(@" XML_DIFF_PATH ",'/" XML_CIB_TAG_CRMCONFIG "/')]"
139d2d
+
139d2d
 gboolean
139d2d
-cib_internal_config_changed(xmlNode * diff)
139d2d
+cib_internal_config_changed(xmlNode *diff)
139d2d
 {
139d2d
     gboolean changed = FALSE;
139d2d
-    xmlXPathObject *xpathObj = NULL;
139d2d
 
139d2d
-    if (diff == NULL) {
139d2d
-        return FALSE;
139d2d
-    }
139d2d
+    if (diff) {
139d2d
+        xmlXPathObject *xpathObj = xpath_search(diff, XPATH_CONFIG_CHANGE);
139d2d
 
139d2d
-    xpathObj = xpath_search(diff, "//" XML_CIB_TAG_CRMCONFIG);
139d2d
-    if (numXpathResults(xpathObj) > 0) {
139d2d
-        changed = TRUE;
139d2d
+        if (numXpathResults(xpathObj) > 0) {
139d2d
+            changed = TRUE;
139d2d
+        }
139d2d
+        freeXpathObject(xpathObj);
139d2d
     }
139d2d
-
139d2d
-    freeXpathObject(xpathObj);
139d2d
-
139d2d
     return changed;
139d2d
 }
139d2d
 
139d2d
-- 
139d2d
1.8.3.1
139d2d
139d2d
139d2d
From 3e5cdd9b329b3328a88912db48c4e4a4d6f94563 Mon Sep 17 00:00:00 2001
139d2d
From: Ken Gaillot <kgaillot@redhat.com>
139d2d
Date: Fri, 9 Jun 2017 15:33:27 -0500
139d2d
Subject: [PATCH 6/8] Feature: cib,libcib: support option for IPC eviction
139d2d
 threshold
139d2d
139d2d
Only the cib utilizes the option currently, but the other daemons
139d2d
could easily do the same, if they are subject to large IPC bursts.
139d2d
---
139d2d
 cib/callbacks.c     | 13 +++++++++++++
139d2d
 cib/callbacks.h     | 10 ++++++++++
139d2d
 lib/cib/cib_utils.c | 24 ++++++++++++++++++++----
139d2d
 3 files changed, 43 insertions(+), 4 deletions(-)
139d2d
139d2d
diff --git a/cib/callbacks.c b/cib/callbacks.c
139d2d
index 4708f10..544a920 100644
139d2d
--- a/cib/callbacks.c
139d2d
+++ b/cib/callbacks.c
139d2d
@@ -281,6 +281,19 @@ cib_common_callback(qb_ipcs_connection_t * c, void *data, size_t size, gboolean
139d2d
             cib_client->name = crm_itoa(cib_client->pid);
139d2d
         } else {
139d2d
             cib_client->name = strdup(value);
139d2d
+            if (crm_is_daemon_name(value)) {
139d2d
+                set_bit(cib_client->options, cib_is_daemon);
139d2d
+            }
139d2d
+        }
139d2d
+    }
139d2d
+
139d2d
+    /* Allow cluster daemons more leeway before being evicted */
139d2d
+    if (is_set(cib_client->options, cib_is_daemon)) {
139d2d
+        const char *qmax = cib_config_lookup("cluster-ipc-limit");
139d2d
+
139d2d
+        if (crm_set_client_queue_max(cib_client, qmax)) {
139d2d
+            crm_trace("IPC threshold for %s[%u] is now %u",
139d2d
+                      cib_client->name, cib_client->pid, cib_client->queue_max);
139d2d
         }
139d2d
     }
139d2d
 
139d2d
diff --git a/cib/callbacks.h b/cib/callbacks.h
139d2d
index b4d48d6..bddff09 100644
139d2d
--- a/cib/callbacks.h
139d2d
+++ b/cib/callbacks.h
139d2d
@@ -19,6 +19,7 @@
139d2d
 #include <stdio.h>
139d2d
 #include <sys/types.h>
139d2d
 #include <unistd.h>
139d2d
+#include <glib.h>
139d2d
 
139d2d
 #include <crm/crm.h>
139d2d
 #include <crm/cib.h>
139d2d
@@ -43,6 +44,9 @@ enum cib_notifications
139d2d
     cib_notify_replace = 0x0004,
139d2d
     cib_notify_confirm = 0x0008,
139d2d
     cib_notify_diff    = 0x0010,
139d2d
+
139d2d
+    /* not a notification, but uses the same IPC bitmask */
139d2d
+    cib_is_daemon      = 0x1000, /* whether client is another cluster daemon */
139d2d
 };
139d2d
 /* *INDENT-ON* */
139d2d
 
139d2d
@@ -80,3 +84,9 @@ extern void cib_ha_peer_callback(HA_Message * msg, void *private_data);
139d2d
 extern int cib_ccm_dispatch(gpointer user_data);
139d2d
 extern void cib_ccm_msg_callback(oc_ed_t event, void *cookie, size_t size, const void *data);
139d2d
 #endif
139d2d
+
139d2d
+static inline const char *
139d2d
+cib_config_lookup(const char *opt)
139d2d
+{
139d2d
+    return g_hash_table_lookup(config_hash, opt);
139d2d
+}
139d2d
diff --git a/lib/cib/cib_utils.c b/lib/cib/cib_utils.c
139d2d
index f639ada..adbf9c8 100644
139d2d
--- a/lib/cib/cib_utils.c
139d2d
+++ b/lib/cib/cib_utils.c
139d2d
@@ -699,10 +699,26 @@ cib_native_notify(gpointer data, gpointer user_data)
139d2d
 }
139d2d
 
139d2d
 pe_cluster_option cib_opts[] = {
139d2d
-    /* name, old-name, validate, default, description */
139d2d
-    {"enable-acl", NULL, "boolean", NULL, "false", &check_boolean,
139d2d
-     "Enable CIB ACL", NULL}
139d2d
-    ,
139d2d
+    /*
139d2d
+     * name, legacy name,
139d2d
+     * type, allowed values, default, validator,
139d2d
+     * short description,
139d2d
+     * long description
139d2d
+     */
139d2d
+    {
139d2d
+        "enable-acl", NULL,
139d2d
+        "boolean", NULL, "false", &check_boolean,
139d2d
+        "Enable CIB ACL",
139d2d
+        NULL
139d2d
+    },
139d2d
+    {
139d2d
+        "cluster-ipc-limit", NULL,
139d2d
+        "integer", NULL, "500", &check_positive_number,
139d2d
+        "Maximum IPC message backlog before disconnecting a cluster daemon",
139d2d
+        "Raise this if log has \"Evicting client\" messages for cluster daemon"
139d2d
+            " PIDs (a good value is the number of resources in the cluster"
139d2d
+            " multiplied by the number of nodes)"
139d2d
+    },
139d2d
 };
139d2d
 
139d2d
 void
139d2d
-- 
139d2d
1.8.3.1
139d2d
139d2d
139d2d
From 3f855794adbe9ad46aaca3848d591f5dc26d3371 Mon Sep 17 00:00:00 2001
139d2d
From: Ken Gaillot <kgaillot@redhat.com>
139d2d
Date: Tue, 13 Jun 2017 18:07:45 -0500
139d2d
Subject: [PATCH 7/8] Doc: Pacemaker Explained: document cluster-ipc-limit
139d2d
139d2d
---
139d2d
 doc/Pacemaker_Explained/en-US/Ch-Options.txt | 9 +++++++++
139d2d
 1 file changed, 9 insertions(+)
139d2d
139d2d
diff --git a/doc/Pacemaker_Explained/en-US/Ch-Options.txt b/doc/Pacemaker_Explained/en-US/Ch-Options.txt
139d2d
index f4e1af7..ec0c6b9 100644
139d2d
--- a/doc/Pacemaker_Explained/en-US/Ch-Options.txt
139d2d
+++ b/doc/Pacemaker_Explained/en-US/Ch-Options.txt
139d2d
@@ -267,6 +267,15 @@ take effect, we can optionally poll the cluster's status for changes. A value
139d2d
 of 0 disables polling. Positive values are an interval (in seconds unless other
139d2d
 SI units are specified, e.g. 5min).
139d2d
 
139d2d
+| cluster-ipc-limit | 500 |
139d2d
+indexterm:[cluster-ipc-limit,Cluster Option]
139d2d
+indexterm:[Cluster,Option,cluster-ipc-limit]
139d2d
+The maximum IPC message backlog before one cluster daemon will disconnect
139d2d
+another. This is of use in large clusters, for which a good value is the number
139d2d
+of resources in the cluster multiplied by the number of nodes. The default of
139d2d
+500 is also the minimum. Raise this if you see "Evicting client" messages for
139d2d
+cluster daemon PIDs in the logs.
139d2d
+
139d2d
 | pe-error-series-max | -1 |
139d2d
 indexterm:[pe-error-series-max,Cluster Option]
139d2d
 indexterm:[Cluster,Option,pe-error-series-max]
139d2d
-- 
139d2d
1.8.3.1
139d2d
139d2d
139d2d
From bc6d723a94221419b15650a52e8ed1d843a32ff1 Mon Sep 17 00:00:00 2001
139d2d
From: Ken Gaillot <kgaillot@redhat.com>
139d2d
Date: Thu, 15 Jun 2017 14:20:27 -0500
139d2d
Subject: [PATCH 8/8] Refactor: libcrmcommon: avoid redundant constant
139d2d
 definitions
139d2d
139d2d
---
139d2d
 lib/common/ipc.c | 9 ++++++---
139d2d
 1 file changed, 6 insertions(+), 3 deletions(-)
139d2d
139d2d
diff --git a/lib/common/ipc.c b/lib/common/ipc.c
139d2d
index 3110334..c238bca 100644
139d2d
--- a/lib/common/ipc.c
139d2d
+++ b/lib/common/ipc.c
139d2d
@@ -39,7 +39,6 @@
139d2d
 
139d2d
 /* Evict clients whose event queue grows this large (by default) */
139d2d
 #define PCMK_IPC_DEFAULT_QUEUE_MAX 500
139d2d
-#define PCMK_IPC_DEFAULT_QUEUE_MAX_S "500"
139d2d
 
139d2d
 struct crm_ipc_response_header {
139d2d
     struct qb_ipc_response_header qb;
139d2d
@@ -422,8 +421,12 @@ bool
139d2d
 crm_set_client_queue_max(crm_client_t *client, const char *qmax)
139d2d
 {
139d2d
     if (is_set(client->flags, crm_client_flag_ipc_privileged)) {
139d2d
-        client->queue_max = crm_parse_int(qmax, PCMK_IPC_DEFAULT_QUEUE_MAX_S);
139d2d
-        return TRUE;
139d2d
+        int qmax_int = crm_int_helper(qmax, NULL);
139d2d
+
139d2d
+        if ((errno == 0) && (qmax_int > 0)) {
139d2d
+            client->queue_max = qmax_int;
139d2d
+            return TRUE;
139d2d
+        }
139d2d
     }
139d2d
     return FALSE;
139d2d
 }
139d2d
-- 
139d2d
1.8.3.1
139d2d