monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[monit-dev] [monit] r351 committed - * Fix crash when monit daemon start


From: monit
Subject: [monit-dev] [monit] r351 committed - * Fix crash when monit daemon start delay option was used and monit...
Date: Sun, 27 Mar 2011 09:00:27 +0000

Revision: 351
Author:   address@hidden
Date:     Sun Mar 27 01:59:46 2011
Log: * Fix crash when monit daemon start delay option was used and monit
  was signalized to stop before the start delay passed. Thanks to
  John Schult for report.



http://code.google.com/p/monit/source/detail?r=351

Modified:
 /trunk/CHANGES.txt
 /trunk/monitor.c

=======================================
--- /trunk/CHANGES.txt  Wed Mar 23 03:15:53 2011
+++ /trunk/CHANGES.txt  Sun Mar 27 01:59:46 2011
@@ -9,31 +9,35 @@

 Version 5.2.5

-* Fix process match check - when the monitored process failed and was
-  restarted by Monit, Monit didn't recognized it is running after the
-  restart and reported start failure (similar on stop). Thanks to
-  Kenichi Futatsumori for report and helping to root cause the problem.
-
-* Fix Debian #617259: symbolic links in the filesystem check doesn't work.
-  Thanks to Sergey B Kirpichev for report.
-
-* Fix Debian bug #614984: smtp protocol test issues both EHLO and HELO.
-  Thanks to Sergey B Kirpichev for report.
-
-* Fix bug #32583: Multiple SIP OPTIONS messages use the same header data.
-  Thanks to Hugh Waite for patch.
+* Fix process match check - when the monitored process failed and
+  was restarted by Monit, Monit didn't recognized  it is  running
+  after the restart and reported  start failure (similar on stop).
+  Thanks to  Kenichi Futatsumori for report and  helping to root
+  cause the problem.
+
+* Fix Debian #617259: symbolic links in the filesystem check doesn't
+  work.  Thanks to Sergey B Kirpichev for report.
+
+* Fix Debian bug #614984: smtp protocol test issues both EHLO and
+  HELO.  Thanks to Sergey B Kirpichev for report.
+
+* Fix bug #32583: Multiple SIP OPTIONS messages use the same header
+  data.  Thanks to Hugh Waite for patch.

 * Try harder to get FQDN hostname for the host where monit is running.
   The hostname in the $HOST variable which is used in the mail sender
   may thus change. Thanks to Sergey B Kirpichev for patch.

-* AIX: Fix the time display which was off by GMT difference. Thanks to
-  Helen Chen for report.
+* AIX: Fix the time display which was off by GMT difference. Thanks
+  to Helen Chen for report.

 * AIX: Fix the M/Monit heartbeat. Thanks to Helen Chen for report.

 * Support symbolic link to monit configuration file.

+* Fix crash when monit daemon start delay option was used and monit
+  was signalized to stop before the start delay passed. Thanks to
+  John Schult for report.



=======================================
--- /trunk/monitor.c    Wed Mar 23 14:17:00 2011
+++ /trunk/monitor.c    Sun Mar 27 01:59:46 2011
@@ -124,9 +124,10 @@
ServiceGroup_T servicegrouplist;/**< The service group list (created in p.y) */ SystemInfo_T systeminfo; /**< System infomation */

-pthread_t heartbeatThread; /**< M/Monit heartbeat thread */ -pthread_cond_t heartbeatCond; /**< Hearbeat wakeup condition */ -pthread_mutex_t heartbeatMutex; /**< Hearbeat mutex */ +pthread_t heartbeatThread; /**< M/Monit heartbeat thread */ +pthread_cond_t heartbeatCond; /**< Hearbeat wakeup condition */ +pthread_mutex_t heartbeatMutex; /**< Hearbeat mutex */ +static volatile int heartbeatRunning = FALSE; /**< Heartbeat thread flag */

 int ptreesize = 0;
 int oldptreesize = 0;
@@ -330,11 +331,12 @@
   LogInfo("Awakened by the SIGHUP signal\n");
LogInfo("Reinitializing %s - Control file '%s'\n", prog, Run.controlfile);

-  if(Run.mmonits) {
+  if(Run.mmonits && heartbeatRunning) {
     if ((status = pthread_cond_signal(&heartbeatCond)) != 0)
LogError("%s: Failed to signal the heartbeat thread -- %s\n", prog, strerror(status));
     if ((status = pthread_join(heartbeatThread, NULL)) != 0)
LogError("%s: Failed to stop the heartbeat thread -- %s\n", prog, strerror(status));
+    heartbeatRunning = FALSE;
   }

   Run.doreload = FALSE;
@@ -388,6 +390,8 @@

if(Run.mmonits && ((status = pthread_create(&heartbeatThread, NULL, heartbeat, NULL)) != 0)) LogError("%s: Failed to create the heartbeat thread -- %s\n", prog, strerror(status));
+  else
+    heartbeatRunning = TRUE;
 }


@@ -481,11 +485,12 @@
     if (can_http())
       monit_http(STOP_HTTP);

-    if(Run.mmonits) {
+    if(Run.mmonits && heartbeatRunning) {
       if ((status = pthread_cond_signal(&heartbeatCond)) != 0)
LogError("%s: Failed to signal the heartbeat thread -- %s\n", prog, strerror(status));
       if ((status = pthread_join(heartbeatThread, NULL)) != 0)
LogError("%s: Failed to stop the heartbeat thread -- %s\n", prog, strerror(status));
+      heartbeatRunning = FALSE;
     }

     LogInfo("%s daemon with pid [%d] killed\n", prog, (int)getpid());
@@ -555,6 +560,8 @@

if(Run.mmonits && ((status = pthread_create(&heartbeatThread, NULL, heartbeat, NULL)) != 0)) LogError("%s: Failed to create the heartbeat thread -- %s\n", prog, strerror(status));
+    else
+      heartbeatRunning = TRUE;

     while (TRUE) {
       validate();



reply via email to

[Prev in Thread] Current Thread [Next in Thread]