[Reconnoiter-devel] [reconnoiter commit] Reconnoiter branch, master, updated. 66cf6d4b55d526fdb6724e700480033f198045fa

git at labs.omniti.com git at labs.omniti.com
Sun Apr 22 10:31:13 EDT 2012


Pushed by: jesus
The branch, master has been updated
       via  66cf6d4b55d526fdb6724e700480033f198045fa (commit)
       via  2aa05d4ff7651db8e132f49e6248b0f29a88bffa (commit)
      from  658ca094d9985caeb69da119a4a9ebc6f063e8b7 (commit)

Summary of changes:
 src/noit_main.c           |   36 +++++++++++++++++++-----------------
 src/noitd.c               |    2 +-
 src/stratcond.c           |    2 +-
 src/utils/noit_watchdog.c |    5 +++--
 4 files changed, 24 insertions(+), 21 deletions(-)

Log:
commit 66cf6d4b55d526fdb6724e700480033f198045fa
Author: Theo Schlossnagle <jesus at omniti.com>
Date:   Sun Apr 22 10:27:27 2012 -0400

    We're seeing at times on very busy systems that once a deadman
    triggers, it will continue to trigger indefinitely.  After much
    testing it would appear that this happens if the parent continues
    executing th before the child executs its first function (resetting
    the hearbeat used for the deadman).  This seems possible, but still
    very unlikley to repeat indefinitely.  It is clear I don't fully
    understand the pathology of this failure mode.
    
    Regardless, it would seem safe to move the reset of the hearbeat into
    the parent immediately prior to the fork.  This should remove any race
    and guarantee that we have the full deadman timeout to boot to a live
    eventer state.

diff --git a/src/utils/noit_watchdog.c b/src/utils/noit_watchdog.c
index d21fd94..d93ef13 100644
--- a/src/utils/noit_watchdog.c
+++ b/src/utils/noit_watchdog.c
@@ -137,14 +137,14 @@ int noit_watchdog_start_child(const char *app, int (*func)(),
   if(child_watchdog_timeout == 0)
     child_watchdog_timeout = CHILD_WATCHDOG_TIMEOUT;
   while(1) {
+    /* This sets up things so we start alive */
+    it_ticks_zero();
     child_pid = fork();
     if(child_pid == -1) {
       noitL(noit_error, "fork failed: %s\n", strerror(errno));
       exit(-1);
     }
     if(child_pid == 0) {
-      /* This sets up things so we start alive */
-      it_ticks_zero();
       /* trace handlers */
       noit_monitored_child_pid = getpid();
       if(glider_path) {
@@ -194,6 +194,7 @@ int noit_watchdog_start_child(const char *app, int (*func)(),
           run_glider(child_pid);
           kill(child_pid, SIGKILL);
         }
+        noitL(noit_debug, "last_tick_time -> %lu\n", ltt);
       }
       noitL(noit_error, "%s child died [%d/%d], restarting.\n",
             app, exit_val, sig);

commit 2aa05d4ff7651db8e132f49e6248b0f29a88bffa
Author: Theo Schlossnagle <jesus at omniti.com>
Date:   Sun Apr 22 10:26:59 2012 -0400

    Add support for -D -D which will foreground the parent, but still fork and manage the child.  Mainly for debugging dysfunctional parent-child relationships.

diff --git a/src/noit_main.c b/src/noit_main.c
index 66fd250..5b84178 100644
--- a/src/noit_main.c
+++ b/src/noit_main.c
@@ -214,7 +214,7 @@ noit_main(const char *appname,
     }
   }
 
-  if(foreground) return passed_child_main();
+  if(foreground == 1) return passed_child_main();
 
   watchdog_timeout_str = getenv("WATCHDOG_TIMEOUT");
   if(watchdog_timeout_str) {
@@ -223,22 +223,24 @@ noit_main(const char *appname,
           watchdog_timeout);
   }
 
-  /* This isn't inherited across forks... */
-  if(lockfd >= 0) noit_lockfile_release(lockfd);
-
-  fd = open("/dev/null", O_RDWR);
-  dup2(fd, STDIN_FILENO);
-  dup2(fd, STDOUT_FILENO);
-  dup2(fd, STDERR_FILENO);
-  if(fork()) exit(0);
-  setsid();
-  if(fork()) exit(0);
-
-  /* Reacquire the lock */
-  if(*lockfile) {
-    if(noit_lockfile_acquire(lockfile) < 0) {
-      noitL(noit_stderr, "Failed to acquire lock: %s\n", lockfile);
-      exit(-1);
+  if(foreground < 1) {
+    /* This isn't inherited across forks... */
+    if(lockfd >= 0) noit_lockfile_release(lockfd);
+
+    fd = open("/dev/null", O_RDWR);
+    dup2(fd, STDIN_FILENO);
+    dup2(fd, STDOUT_FILENO);
+    dup2(fd, STDERR_FILENO);
+    if(fork()) exit(0);
+    setsid();
+    if(fork()) exit(0);
+
+    /* Reacquire the lock */
+    if(*lockfile) {
+      if(noit_lockfile_acquire(lockfile) < 0) {
+        noitL(noit_stderr, "Failed to acquire lock: %s\n", lockfile);
+        exit(-1);
+      }
     }
   }
 
diff --git a/src/noitd.c b/src/noitd.c
index 8d50a1f..a2b8cc9 100644
--- a/src/noitd.c
+++ b/src/noitd.c
@@ -120,7 +120,7 @@ void parse_clargs(int argc, char **argv) {
         config_file = strdup(optarg);
         break;
       case 'D':
-        foreground = 1;
+        foreground++;
         break;
       case 'd':
         debug++;
diff --git a/src/stratcond.c b/src/stratcond.c
index 33fc5fe..f4ee97a 100644
--- a/src/stratcond.c
+++ b/src/stratcond.c
@@ -123,7 +123,7 @@ void parse_clargs(int argc, char **argv) {
         debug++;
         break;
       case 'D':
-        foreground = 1;
+        foreground++;
         break;
       default:
         break;




hooks/post-receive
-- 
Reconnoiter


More information about the Reconnoiter-devel mailing list