Add some additional signal info to the crash log (#7891)

- si_code can be very useful info some day.
- a clear indication that redis was killed by an external user
This commit is contained in:
Oran Agra 2020-10-07 20:28:57 +03:00 committed by GitHub
parent 216c110609
commit f659d23619
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1724,11 +1724,14 @@ void sigsegvHandler(int sig, siginfo_t *info, void *secret) {
bugReportStart(); bugReportStart();
serverLog(LL_WARNING, serverLog(LL_WARNING,
"Redis %s crashed by signal: %d", REDIS_VERSION, sig); "Redis %s crashed by signal: %d, si_code: %d", REDIS_VERSION, sig, info->si_code);
if (sig == SIGSEGV || sig == SIGBUS) { if (sig == SIGSEGV || sig == SIGBUS) {
serverLog(LL_WARNING, serverLog(LL_WARNING,
"Accessing address: %p", (void*)info->si_addr); "Accessing address: %p", (void*)info->si_addr);
} }
if (info->si_pid != -1) {
serverLog(LL_WARNING, "Killed by PID: %d, UID: %d", info->si_pid, info->si_uid);
}
#ifdef HAVE_BACKTRACE #ifdef HAVE_BACKTRACE
ucontext_t *uc = (ucontext_t*) secret; ucontext_t *uc = (ucontext_t*) secret;