Commit 0b9a99db authored by tomas@poseidon.(none)'s avatar tomas@poseidon.(none)

see resp. file

parent 7000ffde
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
// Used here only to print event reports on stdout/console. // Used here only to print event reports on stdout/console.
EventLogger g_eventLogger; EventLogger g_eventLogger;
extern int simulate_error_during_shutdown;
Cmvmi::Cmvmi(const Configuration & conf) : Cmvmi::Cmvmi(const Configuration & conf) :
SimulatedBlock(CMVMI, conf) SimulatedBlock(CMVMI, conf)
...@@ -148,6 +149,16 @@ void Cmvmi::execNDB_TAMPER(Signal* signal) ...@@ -148,6 +149,16 @@ void Cmvmi::execNDB_TAMPER(Signal* signal)
if(ERROR_INSERTED(9997)){ if(ERROR_INSERTED(9997)){
ndbrequire(false); ndbrequire(false);
} }
if(ERROR_INSERTED(9996)){
simulate_error_during_shutdown= SIGSEGV;
ndbrequire(false);
}
if(ERROR_INSERTED(9995)){
simulate_error_during_shutdown= SIGSEGV;
kill(getpid(), SIGABRT);
}
}//execNDB_TAMPER() }//execNDB_TAMPER()
void Cmvmi::execSET_LOGLEVELORD(Signal* signal) void Cmvmi::execSET_LOGLEVELORD(Signal* signal)
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
extern const char programName[]; extern const char programName[];
#define ERROR_SET_SIGNAL(messageCategory, messageID, problemData, objectRef) \
ErrorReporter::handleError(messageCategory, messageID, problemData, objectRef, NST_ErrorHandlerSignal)
#define ERROR_SET(messageCategory, messageID, problemData, objectRef) \ #define ERROR_SET(messageCategory, messageID, problemData, objectRef) \
ErrorReporter::handleError(messageCategory, messageID, problemData, objectRef) ErrorReporter::handleError(messageCategory, messageID, problemData, objectRef)
// Description: // Description:
......
...@@ -335,7 +335,13 @@ handler_error(int signum){ ...@@ -335,7 +335,13 @@ handler_error(int signum){
static long thread_id= 0; static long thread_id= 0;
if (thread_id != 0 && thread_id == my_thread_id()) if (thread_id != 0 && thread_id == my_thread_id())
; // Shutdown thread received signal {
// Shutdown thread received signal
signal(signum, SIG_DFL);
kill(getpid(), signum);
while(true)
NdbSleep_MilliSleep(10);
}
if(theShutdownMutex && NdbMutex_Trylock(theShutdownMutex) != 0) if(theShutdownMutex && NdbMutex_Trylock(theShutdownMutex) != 0)
while(true) while(true)
NdbSleep_MilliSleep(10); NdbSleep_MilliSleep(10);
...@@ -344,5 +350,5 @@ handler_error(int signum){ ...@@ -344,5 +350,5 @@ handler_error(int 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_SIGNAL(fatal, 0, errorData, __FILE__);
} }
...@@ -61,6 +61,7 @@ Uint32 theEmulatedJamBlockNumber = 0; ...@@ -61,6 +61,7 @@ Uint32 theEmulatedJamBlockNumber = 0;
EmulatorData globalEmulatorData; EmulatorData globalEmulatorData;
NdbMutex * theShutdownMutex = 0; NdbMutex * theShutdownMutex = 0;
int simulate_error_during_shutdown= 0;
EmulatorData::EmulatorData(){ EmulatorData::EmulatorData(){
theConfiguration = 0; theConfiguration = 0;
...@@ -117,7 +118,8 @@ NdbShutdown(NdbShutdownType type, ...@@ -117,7 +118,8 @@ NdbShutdown(NdbShutdownType type,
} }
} }
if(NdbMutex_Trylock(theShutdownMutex) == 0){ if((type == NST_ErrorHandlerSignal) || // Signal handler has already locked mutex
(NdbMutex_Trylock(theShutdownMutex) == 0)){
globalData.theRestartFlag = perform_stop; globalData.theRestartFlag = perform_stop;
bool restart = false; bool restart = false;
...@@ -145,6 +147,9 @@ NdbShutdown(NdbShutdownType type, ...@@ -145,6 +147,9 @@ NdbShutdown(NdbShutdownType type,
case NST_ErrorHandler: case NST_ErrorHandler:
ndbout << "Error handler " << shutting << " system" << endl; ndbout << "Error handler " << shutting << " system" << endl;
break; break;
case NST_ErrorHandlerSignal:
ndbout << "Error handler signal " << shutting << " system" << endl;
break;
case NST_Restart: case NST_Restart:
ndbout << "Restarting system" << endl; ndbout << "Restarting system" << endl;
break; break;
...@@ -175,6 +180,12 @@ NdbShutdown(NdbShutdownType type, ...@@ -175,6 +180,12 @@ NdbShutdown(NdbShutdownType type,
#endif #endif
} }
if (simulate_error_during_shutdown) {
kill(getpid(), simulate_error_during_shutdown);
while(true)
NdbSleep_MilliSleep(10);
}
globalEmulatorData.theWatchDog->doStop(); globalEmulatorData.theWatchDog->doStop();
#ifdef VM_TRACE #ifdef VM_TRACE
......
...@@ -79,6 +79,7 @@ enum NdbShutdownType { ...@@ -79,6 +79,7 @@ enum NdbShutdownType {
NST_Normal, NST_Normal,
NST_Watchdog, NST_Watchdog,
NST_ErrorHandler, NST_ErrorHandler,
NST_ErrorHandlerSignal,
NST_Restart, NST_Restart,
NST_ErrorInsert NST_ErrorInsert
}; };
......
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