From 0aed0312ec75c5e0865077859c2f3a5966168730 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Thu, 28 Nov 2019 20:33:05 +0100 Subject: [PATCH] wait for suicide to actually take place before we fail this --- lib/Basics/debugging.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/Basics/debugging.cpp b/lib/Basics/debugging.cpp index afe4a57c23..78b021bfa8 100644 --- a/lib/Basics/debugging.cpp +++ b/lib/Basics/debugging.cpp @@ -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