From f81f985f37ccdcf04aa9707fe994a0c87f67b1a8 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 29 Aug 2016 11:53:33 +0200 Subject: fix conpilation on OpenBSD --- sql/signal_handler.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sql/signal_handler.cc') diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index fd6f62fa100..c3f25848e8a 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -64,13 +64,13 @@ extern "C" sig_handler handle_fatal_signal(int sig) struct tm tm; #ifdef HAVE_STACKTRACE THD *thd; -#endif /* This flag remembers if the query pointer was found invalid. We will try and print the query at the end of the signal handler, in case we're wrong. */ bool print_invalid_query_pointer= false; +#endif if (segfaulted) { @@ -265,6 +265,7 @@ extern "C" sig_handler handle_fatal_signal(int sig) "\"mlockall\" bugs.\n"); } +#ifdef HAVE_STACKTRACE if (print_invalid_query_pointer) { my_safe_printf_stderr( @@ -274,6 +275,7 @@ extern "C" sig_handler handle_fatal_signal(int sig) my_write_stderr(thd->query(), MY_MIN(65536U, thd->query_length())); my_safe_printf_stderr("\n\n"); } +#endif #ifdef HAVE_WRITE_CORE if (test_flags & TEST_CORE_ON_SIGNAL) -- cgit v1.2.1 From 76546a099c24a06ad89238f61435051a4663b112 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 5 Dec 2016 15:51:24 +0100 Subject: 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() --- sql/signal_handler.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sql/signal_handler.cc') diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index f72eb676743..6593c3f3dbc 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -75,7 +75,7 @@ extern "C" sig_handler handle_fatal_signal(int sig) if (segfaulted) { my_safe_printf_stderr("Fatal " SIGNAL_FMT " while backtracing\n", sig); - _exit(1); /* Quit without running destructors */ + goto end; } segfaulted = 1; @@ -301,9 +301,11 @@ end: #ifndef __WIN__ /* 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. */ - _exit(1); // Using _exit(), since exit() is not async signal safe + signal(sig, SIG_DFL); + kill(getpid(), sig); #else return; #endif -- cgit v1.2.1