MXS-2221 Fatal signal handling does not always create a core

Quick and simple fix, but this should be overhauled. See MXS-599.
This commit is contained in:
Niclas Antti 2018-12-11 13:51:44 +02:00
parent 48efa6d027
commit f2a3a5737a

View File

@ -493,12 +493,12 @@ void extract_file_and_line(const char* symbols, char* cmd, size_t size)
static void
sigfatal_handler(int i)
{
if (fatal_handling)
{
fprintf(stderr, "Fatal signal %d while backtracing\n", i);
_exit(1);
}
fatal_handling = 1;
// The same signal being handled *now* can occur in another thread (and is often likely).
// By setting the default handler here we will always get a core, but not necessarily
// the backtrace into the log file. This should be overhauled to proper signal handling
// (MXS-599).
signal_set(i, SIG_DFL);
MXS_CONFIG* cnf = config_get_global_options();
fprintf(stderr, "Fatal: MaxScale " MAXSCALE_VERSION " received fatal signal %d. "
"Attempting backtrace.\n", i);
@ -539,7 +539,6 @@ sigfatal_handler(int i)
/* re-raise signal to enforce core dump */
fprintf(stderr, "\n\nWriting core dump\n");
signal_set(i, SIG_DFL);
raise(i);
}