From e7fef1df58559f29c16a4571d4218ff291a8050e Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 20 Feb 2012 18:07:38 +0100 Subject: Fix compilation on Windows, and various Windows related mistakes introduced by "safe exception patch". Remove misleading comments suggesting about signal() Windows, the routine here is part of a exception handler, and sig parameter is an exception code. --- sql/signal_handler.cc | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'sql/signal_handler.cc') diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index 23d898fdb5e..6406cd3bae0 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -28,7 +28,7 @@ #endif /* - We are handling signals in this file. + We are handling signals/exceptions in this file. Any global variables we read should be 'volatile sig_atomic_t' to guarantee that we read some consistent value. */ @@ -40,20 +40,18 @@ extern volatile sig_atomic_t ld_assume_kernel_is_set; #endif /** - * Handler for fatal signals + * Handler for fatal signals on POSIX, exception handler on Windows. * * Fatal events (seg.fault, bus error etc.) will trigger * this signal handler. The handler will try to dump relevant * debugging information to stderr and dump a core image. * - * Signal handlers can only use a set of 'safe' system calls - * and library functions. A list of safe calls in POSIX systems + * POSIX : Signal handlers should, if possible, only use a set of 'safe' system + * calls and library functions. A list of safe calls in POSIX systems * are available at: * http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html - * For MS Windows, guidelines are available at: - * http://msdn.microsoft.com/en-us/library/xdkz3x12(v=vs.71).aspx * - * @param sig Signal number + * @param sig Signal number /Exception code */ extern "C" sig_handler handle_fatal_signal(int sig) { @@ -77,7 +75,13 @@ extern "C" sig_handler handle_fatal_signal(int sig) my_safe_printf_stderr("%02d%02d%02d %2d:%02d:%02d ", tm.tm_year % 100, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); - if (opt_expect_abort && sig == SIGABRT) + if (opt_expect_abort +#ifdef _WIN32 + && sig == EXCEPTION_BREAKPOINT /* __debugbreak in my_sigabrt_hander() */ +#else + && sig == SIGABRT +#endif + ) { fprintf(stderr,"[Note] mysqld did an expected abort\n"); goto end; @@ -252,5 +256,7 @@ end: On Windows, do not terminate, but pass control to exception filter. */ _exit(1); // Using _exit(), since exit() is not async signal safe +#else + return; #endif } -- cgit v1.2.1 From 7ed4806b1181c1f003d2d31f997a4ca6609ee794 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Tue, 21 Feb 2012 01:44:50 +0200 Subject: More general handling of memory loss in dlclose (backported from 5.2) Fixed supression in mysql-test-run so it also works on windows. mysql-test/mysql-test-run.pl: Fixed supression so it also works on windows. mysql-test/valgrind.supp: More general handling of memory loss in dlclose (backported from 5.2) sql/signal_handler.cc: Added newlines around link to how to do bug reports --- sql/signal_handler.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sql/signal_handler.cc') diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index 23d898fdb5e..289670ec830 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -88,10 +88,10 @@ extern "C" sig_handler handle_fatal_signal(int sig) my_safe_printf_stderr("%s", "This could be because you hit a bug. It is also possible that this binary\n" "or one of the libraries it was linked against is corrupt, improperly built,\n" - "or misconfigured. This error can also be caused by malfunctioning hardware.\n"); + "or misconfigured. This error can also be caused by malfunctioning hardware.\n\n"); my_safe_printf_stderr("%s", - "To report this bug, see http://kb.askmonty.org/en/reporting-bugs\n"); + "To report this bug, see http://kb.askmonty.org/en/reporting-bugs\n\n"); my_safe_printf_stderr("%s", "We will try our best to scrape up some info that will hopefully help\n" -- cgit v1.2.1 From f4885c092e3414cb4274e055310f27eae1d28819 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Tue, 21 Feb 2012 01:46:51 +0200 Subject: Added missing signal values to signal_handler.cc sql/signal_handler.cc: Added missing signal values. --- sql/signal_handler.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sql/signal_handler.cc') diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index 23d898fdb5e..13396551e7d 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -173,6 +173,12 @@ extern "C" sig_handler handle_fatal_signal(int sig) case THD::KILL_QUERY: kreason= "KILL_QUERY"; break; + case THD::KILL_SYSTEM_THREAD: + kreason= "KILL_SYSTEM_THREAD"; + break; + case THD::KILL_SERVER: + kreason= "KILL_SERVER"; + break; case THD::KILLED_NO_VALUE: kreason= "KILLED_NO_VALUE"; break; -- cgit v1.2.1