Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAOS-14248 engine: strengthen signals handling #13031

Merged
merged 5 commits into from
Sep 19, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions src/engine/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,14 @@ print_backtrace(int signo, siginfo_t *info, void *p)
else
fprintf(stderr, "No useful backtrace available");

/* re-register old handler */
/* re-register old handler
*
* XXX we may choose to forget about old handler and simply register
* signal again as SIG_DFL and raise it for corefile creation
*
* XXX will old handler get accurate/original siginfo_t/ucontext_t ?
* should we instead call it with the same params we got ?
*/
rc = sigaction(signo, &old_handlers[signo], NULL);
if (rc != 0) {
D_ERROR("sigaction() failure registering new and reading old "
Expand All @@ -1160,18 +1167,8 @@ print_backtrace(int signo, siginfo_t *info, void *p)
exit(EXIT_FAILURE);
}

/* XXX we may choose to forget about old handler and simply register
* signal again as SIG_DFL and raise it for corefile creation
*/
if (old_handlers[signo].sa_sigaction != NULL ||
old_handlers[signo].sa_handler != SIG_IGN) {
/* XXX will old handler get accurate siginfo_t/ucontext_t ?
* we may prefer to call it with the same params we got ?
*/
raise(signo);
}

memset(&old_handlers[signo], 0, sizeof(struct sigaction));
/* raise signal again for either old handler or system default action */
raise(signo);
}

int
Expand All @@ -1192,6 +1189,7 @@ main(int argc, char **argv)
sigdelset(&set, SIGFPE);
sigdelset(&set, SIGBUS);
sigdelset(&set, SIGSEGV);
sigdelset(&set, SIGTRAP);
/** also allow abort()/assert() to trigger */
sigdelset(&set, SIGABRT);

Expand All @@ -1208,6 +1206,7 @@ main(int argc, char **argv)
daos_register_sighand(SIGBUS, print_backtrace);
daos_register_sighand(SIGSEGV, print_backtrace);
daos_register_sighand(SIGABRT, print_backtrace);
daos_register_sighand(SIGTRAP, print_backtrace);

/** server initialization */
rc = server_init(argc, argv);
Expand Down Expand Up @@ -1286,6 +1285,8 @@ main(int argc, char **argv)
if (sig == SIGUSR1) {
D_INFO("got SIGUSR1, dumping Argobots infos and ULTs stacks\n");
dss_dump_ABT_state(abt_infos);
/* re-add SIGUSR1 to set */
sigaddset(&set, SIGUSR1);
continue;
}

Expand All @@ -1297,6 +1298,8 @@ main(int argc, char **argv)
ABT_info_trigger_print_all_thread_stacks(abt_infos,
10.0, NULL,
NULL);
/* re-add SIGUSR2 to set */
sigaddset(&set, SIGUSR2);
continue;
}

Expand Down