Commit 49a7cb3a authored by unknown's avatar unknown

fixed so that error handler is only invoked once

parent 89e0e3a5
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h> #include <ndb_global.h>
#include <my_pthread.h>
#include <ndb_version.h> #include <ndb_version.h>
#include "Configuration.hpp" #include "Configuration.hpp"
...@@ -26,6 +27,7 @@ ...@@ -26,6 +27,7 @@
#include <NdbOut.hpp> #include <NdbOut.hpp>
#include <NdbMain.h> #include <NdbMain.h>
#include <NdbDaemon.h> #include <NdbDaemon.h>
#include <NdbSleep.h>
#include <NdbConfig.h> #include <NdbConfig.h>
#include <WatchDog.hpp> #include <WatchDog.hpp>
...@@ -39,6 +41,7 @@ ...@@ -39,6 +41,7 @@
#endif #endif
extern EventLogger g_eventLogger; extern EventLogger g_eventLogger;
extern NdbMutex * theShutdownMutex;
void catchsigs(bool ignore); // for process signal handling void catchsigs(bool ignore); // for process signal handling
...@@ -328,16 +331,18 @@ handler_shutdown(int signum){ ...@@ -328,16 +331,18 @@ handler_shutdown(int signum){
extern "C" extern "C"
void void
handler_error(int signum){ handler_error(int signum){
// only let one thread run shutdown
static long thread_id= 0;
if (thread_id != 0 && thread_id == my_thread_id())
; // Shutdown thread received signal
if(theShutdownMutex && NdbMutex_Trylock(theShutdownMutex) != 0)
while(true)
NdbSleep_MilliSleep(10);
thread_id= my_thread_id();
g_eventLogger.info("Received signal %d. Running error handler.", signum); g_eventLogger.info("Received signal %d. Running error handler.", signum);
// restart the system // restart the system
char errorData[40]; char errorData[40];
snprintf(errorData, 40, "Signal %d received", signum); snprintf(errorData, 40, "Signal %d received", signum);
ERROR_SET(fatal, 0, errorData, __FILE__); ERROR_SET(fatal, 0, errorData, __FILE__);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment