1
0
Fork 0

wait for suicide to actually take place before we fail this

This commit is contained in:
Wilfried Goesgens 2019-11-28 20:33:05 +01:00
parent 2537e270e8
commit 0aed0312ec
1 changed files with 9 additions and 4 deletions

View File

@ -83,13 +83,18 @@ void TRI_SegfaultDebugging(char const* message) {
TRI_FlushDebugging();
// and now crash
#ifndef __APPLE__
// on MacOS, the following statement makes the server hang but not crash
*((char*)-1) = '!';
#ifdef _WIN32
auto hSelf = GetCurrentProcess();
TerminateProcess(hSelf, -999);
// TerminateProcess is async, alright wait here for selfdestruct (we will never exit wait)
WaitForSingleObject(hSelf, INFINITE);
#else
kill(getpid(), SIGKILL); //to kill the complete process tree.
std::this_thread::sleep_for(std::chrono::seconds(5));
#endif
// ensure the process is terminated
abort();
TRI_ASSERT(false);
}
/// @brief check whether we should fail at a specific failure point