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:
@ -493,12 +493,12 @@ void extract_file_and_line(const char* symbols, char* cmd, size_t size)
|
|||||||
static void
|
static void
|
||||||
sigfatal_handler(int i)
|
sigfatal_handler(int i)
|
||||||
{
|
{
|
||||||
if (fatal_handling)
|
// 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
|
||||||
fprintf(stderr, "Fatal signal %d while backtracing\n", i);
|
// the backtrace into the log file. This should be overhauled to proper signal handling
|
||||||
_exit(1);
|
// (MXS-599).
|
||||||
}
|
signal_set(i, SIG_DFL);
|
||||||
fatal_handling = 1;
|
|
||||||
MXS_CONFIG* cnf = config_get_global_options();
|
MXS_CONFIG* cnf = config_get_global_options();
|
||||||
fprintf(stderr, "Fatal: MaxScale " MAXSCALE_VERSION " received fatal signal %d. "
|
fprintf(stderr, "Fatal: MaxScale " MAXSCALE_VERSION " received fatal signal %d. "
|
||||||
"Attempting backtrace.\n", i);
|
"Attempting backtrace.\n", i);
|
||||||
@ -539,7 +539,6 @@ sigfatal_handler(int i)
|
|||||||
|
|
||||||
/* re-raise signal to enforce core dump */
|
/* re-raise signal to enforce core dump */
|
||||||
fprintf(stderr, "\n\nWriting core dump\n");
|
fprintf(stderr, "\n\nWriting core dump\n");
|
||||||
signal_set(i, SIG_DFL);
|
|
||||||
raise(i);
|
raise(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user