Commit 76546a09 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-10382 Using systemd, mariadb doesn't restart on crashes

when crashing on a signal, don't exit(), but re-signal it, so that
the caller could check WIFSIGNALED()
parent 5142cd55
...@@ -75,7 +75,7 @@ extern "C" sig_handler handle_fatal_signal(int sig) ...@@ -75,7 +75,7 @@ extern "C" sig_handler handle_fatal_signal(int sig)
if (segfaulted) if (segfaulted)
{ {
my_safe_printf_stderr("Fatal " SIGNAL_FMT " while backtracing\n", sig); my_safe_printf_stderr("Fatal " SIGNAL_FMT " while backtracing\n", sig);
_exit(1); /* Quit without running destructors */ goto end;
} }
segfaulted = 1; segfaulted = 1;
...@@ -301,9 +301,11 @@ extern "C" sig_handler handle_fatal_signal(int sig) ...@@ -301,9 +301,11 @@ extern "C" sig_handler handle_fatal_signal(int sig)
#ifndef __WIN__ #ifndef __WIN__
/* /*
Quit, without running destructors (etc.) Quit, without running destructors (etc.)
Use a signal, because the parent (systemd) can check that with WIFSIGNALED
On Windows, do not terminate, but pass control to exception filter. On Windows, do not terminate, but pass control to exception filter.
*/ */
_exit(1); // Using _exit(), since exit() is not async signal safe signal(sig, SIG_DFL);
kill(getpid(), sig);
#else #else
return; return;
#endif #endif
......
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