[Pkg-nagios-changes] [SCM] Debian packaging for mod gearman. branch, upstream, updated. upstream/1.0.6-34-gd3fb2ec

Sven Nierlein sven at nierlein.de
Wed Aug 24 09:22:00 UTC 2011


The following commit has been merged in the upstream branch:
commit f857ee0bdeeb8155bc8104124b382b38366e4214
Author: Sven Nierlein <sven at nierlein.de>
Date:   Mon Aug 15 16:15:37 2011 +0200

    added optional workaround for plugins exiting with rc 25 because of duplicate execution

diff --git a/Changes b/Changes
index a5db112..6072c8c 100644
--- a/Changes
+++ b/Changes
@@ -3,6 +3,8 @@ This file documents the revision history for mod_gearman.
 1.0.9  Mon Aug 15 16:05:23 CEST 2011
           - nicer error messages for send_multi when zero results transmitted
           - fixed sigsegv when reloading core in combination with exports options
+          - added optional workaround for plugins exiting with rc 25 because
+            of duplicate execution
 
 1.0.8  Fri Jul 22 22:21:34 CEST 2011
           - use identifier for error messages if set
diff --git a/common/utils.c b/common/utils.c
index 78ff2a9..ead2aaf 100644
--- a/common/utils.c
+++ b/common/utils.c
@@ -224,6 +224,8 @@ int set_default_options(mod_gm_opt_t *opt) {
     opt->spawn_rate         = GM_DEFAULT_SPAWN_RATE;
     opt->identifier         = NULL;
 
+    opt->workaround_rc_25   = GM_DISABLED;
+
     opt->host               = NULL;
     opt->service            = NULL;
 
@@ -371,6 +373,13 @@ int parse_args_line(mod_gm_opt_t *opt, char * arg, int recursion_level) {
         opt->active = parse_yes_or_no(value, GM_ENABLED);
         return(GM_OK);
     }
+
+    /* workaround_rc_25 */
+    else if (   !strcmp( key, "workaround_rc_25" ) ) {
+        opt->workaround_rc_25 = parse_yes_or_no(value, GM_ENABLED);
+        return(GM_OK);
+    }
+
     else if ( value == NULL ) {
         gm_log( GM_LOG_ERROR, "unknown switch '%s'\n", key );
         return(GM_OK);
diff --git a/extras/shared.conf b/extras/shared.conf
index 8e0d603..12ee381 100644
--- a/extras/shared.conf
+++ b/extras/shared.conf
@@ -181,3 +181,14 @@ max-jobs=50
 # defined the rate of spawed worker per second as long
 # as there are jobs waiting
 spawn-rate=1
+
+
+# Workarounds
+
+# workaround for rc 25 bug
+# duplicate jobs from gearmand result in exit code 25 of plugins
+# because they are executed twice and get killed because of using
+# the same ressource.
+# Sending results (when exit code is 25 ) will be skipped with this
+# enabled.
+workaround_rc_25=off
diff --git a/extras/standalone_worker.conf b/extras/standalone_worker.conf
index 771800e..c44f2b1 100644
--- a/extras/standalone_worker.conf
+++ b/extras/standalone_worker.conf
@@ -117,3 +117,14 @@ max-jobs=50
 # defined the rate of spawed worker per second as long
 # as there are jobs waiting
 spawn-rate=1
+
+
+# Workarounds
+
+# workaround for rc 25 bug
+# duplicate jobs from gearmand result in exit code 25 of plugins
+# because they are executed twice and get killed because of using
+# the same ressource.
+# Sending results (when exit code is 25 ) will be skipped with this
+# enabled.
+workaround_rc_25=off
diff --git a/include/common.h b/include/common.h
index 5724d94..c11910f 100644
--- a/include/common.h
+++ b/include/common.h
@@ -200,6 +200,7 @@ typedef struct mod_gm_opt_struct {
     int            idle_timeout;                            /**< number of seconds till a idle worker exits */
     int            max_jobs;                                /**< maximum number of jobs done after a worker exits */
     int            spawn_rate;                              /**< number of spawned new worker */
+    int            workaround_rc_25;                        /**< optional workaround for plugins returning exit code 25 */
 /* send_gearman */
     int            timeout;                                 /**< timeout for waiting reading on stdin */
     int            return_code;                             /**< return code */
diff --git a/worker/worker_client.c b/worker/worker_client.c
index 1ff86e6..3910a2f 100644
--- a/worker/worker_client.c
+++ b/worker/worker_client.c
@@ -347,6 +347,17 @@ void send_result_back() {
         return;
     }
 
+    /* workaround for rc 25 bug
+     * duplicate jobs from gearmand result in exit code 25 of plugins
+     * because they are executed twice and get killed because of using
+     * the same ressource.
+     * Sending results (when exit code is 25 ) will be skipped with this
+     * enabled.
+     */
+    if( exec_job->return_code == 25 && mod_gm_opt->workaround_rc_25 == GM_ENABLED ) {
+        return;
+    }
+
     gm_log( GM_LOG_TRACE, "queue: %s\n", exec_job->result_queue );
     temp_buffer1[0]='\x0';
     snprintf( temp_buffer1, sizeof( temp_buffer1 )-1, "host_name=%s\ncore_start_time=%i.%i\nstart_time=%i.%i\nfinish_time=%i.%i\nlatency=%f\nreturn_code=%i\nexited_ok=%i\n",

-- 
Debian packaging for mod gearman.



More information about the Pkg-nagios-changes mailing list