Skip to content

Commit 76546a0

Browse files
committed
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()
1 parent 5142cd5 commit 76546a0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sql/signal_handler.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ extern "C" sig_handler handle_fatal_signal(int sig)
7575
if (segfaulted)
7676
{
7777
my_safe_printf_stderr("Fatal " SIGNAL_FMT " while backtracing\n", sig);
78-
_exit(1); /* Quit without running destructors */
78+
goto end;
7979
}
8080

8181
segfaulted = 1;
@@ -301,9 +301,11 @@ extern "C" sig_handler handle_fatal_signal(int sig)
301301
#ifndef __WIN__
302302
/*
303303
Quit, without running destructors (etc.)
304+
Use a signal, because the parent (systemd) can check that with WIFSIGNALED
304305
On Windows, do not terminate, but pass control to exception filter.
305306
*/
306-
_exit(1); // Using _exit(), since exit() is not async signal safe
307+
signal(sig, SIG_DFL);
308+
kill(getpid(), sig);
307309
#else
308310
return;
309311
#endif

0 commit comments

Comments
 (0)