fix: Revert sigmask change

main
Sean McBride 4 years ago
parent ec935601cb
commit eb4e5b276a

@ -35,7 +35,7 @@ const uint32_t runtime_first_worker_processor = 1;
FILE *runtime_sandbox_perf_log = NULL; FILE *runtime_sandbox_perf_log = NULL;
enum RUNTIME_SCHEDULER runtime_scheduler = RUNTIME_SCHEDULER_EDF; enum RUNTIME_SCHEDULER runtime_scheduler = RUNTIME_SCHEDULER_EDF;
enum RUNTIME_SIGALRM_HANDLER runtime_sigalrm_handler = RUNTIME_SIGALRM_HANDLER_TRIAGED; enum RUNTIME_SIGALRM_HANDLER runtime_sigalrm_handler = RUNTIME_SIGALRM_HANDLER_BROADCAST;
int runtime_worker_core_count; int runtime_worker_core_count;
@ -192,18 +192,9 @@ runtime_start_runtime_worker_threads()
debuglog("Sandboxing environment ready!\n"); debuglog("Sandboxing environment ready!\n");
} }
void
runtime_cleanup()
{
if (runtime_sandbox_perf_log != NULL) fflush(runtime_sandbox_perf_log);
exit(EXIT_SUCCESS);
}
void void
runtime_configure() runtime_configure()
{ {
signal(SIGTERM, runtime_cleanup);
/* Scheduler Policy */ /* Scheduler Policy */
char *scheduler_policy = getenv("SLEDGE_SCHEDULER"); char *scheduler_policy = getenv("SLEDGE_SCHEDULER");
if (scheduler_policy == NULL) scheduler_policy = "EDF"; if (scheduler_policy == NULL) scheduler_policy = "EDF";
@ -218,7 +209,7 @@ runtime_configure()
/* Sigalrm Handler Technique */ /* Sigalrm Handler Technique */
char *sigalrm_policy = getenv("SLEDGE_SIGALRM_HANDLER"); char *sigalrm_policy = getenv("SLEDGE_SIGALRM_HANDLER");
if (sigalrm_policy == NULL) sigalrm_policy = "TRIAGED"; if (sigalrm_policy == NULL) sigalrm_policy = "BROADCAST";
if (strcmp(sigalrm_policy, "BROADCAST") == 0) { if (strcmp(sigalrm_policy, "BROADCAST") == 0) {
runtime_sigalrm_handler = RUNTIME_SIGALRM_HANDLER_BROADCAST; runtime_sigalrm_handler = RUNTIME_SIGALRM_HANDLER_BROADCAST;
} else if (strcmp(sigalrm_policy, "TRIAGED") == 0) { } else if (strcmp(sigalrm_policy, "TRIAGED") == 0) {

@ -30,6 +30,14 @@ uint64_t runtime_worker_threads_deadline[RUNTIME_WORKER_THREAD_CORE_COUNT] = { U
* Shared Process / Listener Thread Logic * * Shared Process / Listener Thread Logic *
*****************************************/ *****************************************/
void
runtime_cleanup()
{
if (runtime_sandbox_perf_log != NULL) fflush(runtime_sandbox_perf_log);
exit(EXIT_SUCCESS);
}
/** /**
* Initialize runtime global state, mask signals, and init http parser * Initialize runtime global state, mask signals, and init http parser
*/ */
@ -56,6 +64,13 @@ runtime_initialize(void)
panic("Invalid scheduler policy set: %u\n", runtime_scheduler); panic("Invalid scheduler policy set: %u\n", runtime_scheduler);
} }
/* Configure Signals */
signal(SIGPIPE, SIG_IGN);
signal(SIGTERM, runtime_cleanup);
/* These should only be unmasked by workers */
software_interrupt_mask_signal(SIGUSR1);
software_interrupt_mask_signal(SIGALRM);
http_parser_settings_initialize(); http_parser_settings_initialize();
admissions_control_initialize(); admissions_control_initialize();
} }

@ -332,8 +332,6 @@ worker_thread_main(void *argument)
software_interrupt_unmask_signal(SIGUSR1); software_interrupt_unmask_signal(SIGUSR1);
} }
signal(SIGPIPE, SIG_IGN);
/* Initialize epoll */ /* Initialize epoll */
worker_thread_epoll_file_descriptor = epoll_create1(0); worker_thread_epoll_file_descriptor = epoll_create1(0);
if (unlikely(worker_thread_epoll_file_descriptor < 0)) panic_err(); if (unlikely(worker_thread_epoll_file_descriptor < 0)) panic_err();

Loading…
Cancel
Save