static void termIntHandler([[maybe_unused]] int arg)
{
- doExit();
+ _exit(1);
}
static void usr1Handler([[maybe_unused]] int arg)
signal(SIGTERM, termIntHandler);
signal(SIGINT, termIntHandler);
}
-#if defined(__SANITIZE_THREAD__) || (defined(__SANITIZE_ADDRESS__) && defined(HAVE_LEAK_SANITIZER_INTERFACE))
- // If san is wanted, we dump the info ourselves
- signal(SIGTERM, termIntHandler);
-#endif
signal(SIGUSR1, usr1Handler);
signal(SIGUSR2, usr2Handler);
return doQueueReloadLuaScript(empty.begin(), empty.end());
}
-void doExitGeneric(bool nicely)
+// This code SHOUD *NOT* BE CALLED BY SIGNAL HANDLERS anymore
+static void doExitGeneric(bool nicely)
{
#if defined(__SANITIZE_THREAD__)
_exit(0); // regression test check for exit 0
#endif
- // Not safe from a signal handler!
- // g_slog->withName("runtime")->info(Logr::Notice, "Exiting on user request")
- static const string msg("Exiting on user request\n");
- (void)write(STDERR_FILENO, msg.data(), msg.size());
+ g_slog->withName("runtime")->info(Logr::Notice, "Exiting on user request", "nicely", Logging::Loggable(nicely));
if (!g_pidfname.empty()) {
unlink(g_pidfname.c_str()); // we can at least try..
g_doneRunning.condVar.wait(lock, [] { return g_doneRunning.done.load(); });
}
// g_rcc.~RecursorControlChannel() do not call, caller still needs it!
+ // Caller will continue doing the orderly shutdown
}
else {
+ // rec_control quit case. Is that still used by test code? bulktests and regression test use quit-nicely
g_rcc.~RecursorControlChannel();
#if defined(__SANITIZE_ADDRESS__) && defined(HAVE_LEAK_SANITIZER_INTERFACE)
clearLuaScript();
}
}
-void doExit()
+static void doExit()
{
doExitGeneric(false);
}