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

see resp. file

parent 7000ffde
......@@ -46,6 +46,7 @@
// Used here only to print event reports on stdout/console.
EventLogger g_eventLogger;
extern int simulate_error_during_shutdown;
Cmvmi::Cmvmi(const Configuration & conf) :
SimulatedBlock(CMVMI, conf)
......@@ -148,6 +149,16 @@ void Cmvmi::execNDB_TAMPER(Signal* signal)
if(ERROR_INSERTED(9997)){
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()
void Cmvmi::execSET_LOGLEVELORD(Signal* signal)
......
......@@ -22,6 +22,8 @@
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) \
ErrorReporter::handleError(messageCategory, messageID, problemData, objectRef)
// Description:
......
......@@ -335,7 +335,13 @@ handler_error(int signum){
static long thread_id= 0;
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)
while(true)
NdbSleep_MilliSleep(10);
......@@ -344,5 +350,5 @@ handler_error(int signum){
// restart the system
char errorData[40];
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;
EmulatorData globalEmulatorData;
NdbMutex * theShutdownMutex = 0;
int simulate_error_during_shutdown= 0;
EmulatorData::EmulatorData(){
theConfiguration = 0;
......@@ -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;
bool restart = false;
......@@ -145,6 +147,9 @@ NdbShutdown(NdbShutdownType type,
case NST_ErrorHandler:
ndbout << "Error handler " << shutting << " system" << endl;
break;
case NST_ErrorHandlerSignal:
ndbout << "Error handler signal " << shutting << " system" << endl;
break;
case NST_Restart:
ndbout << "Restarting system" << endl;
break;
......@@ -175,6 +180,12 @@ NdbShutdown(NdbShutdownType type,
#endif
}
if (simulate_error_during_shutdown) {
kill(getpid(), simulate_error_during_shutdown);
while(true)
NdbSleep_MilliSleep(10);
}
globalEmulatorData.theWatchDog->doStop();
#ifdef VM_TRACE
......
......@@ -79,6 +79,7 @@ enum NdbShutdownType {
NST_Normal,
NST_Watchdog,
NST_ErrorHandler,
NST_ErrorHandlerSignal,
NST_Restart,
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