From 64f1b844bd71d9204dce61c5536c650ca2571d16 Mon Sep 17 00:00:00 2001 From: Roberto De Ioris Date: Wed, 16 Jan 2013 16:50:10 +0100 Subject: [PATCH] fixed unix signal usage in mules and spooler --- core/mule.c | 11 +++++++++++ core/spooler.c | 10 ++++++++++ core/uwsgi.c | 1 + 3 files changed, 22 insertions(+) diff --git a/core/mule.c b/core/mule.c index 1a71708d..df18902e 100644 --- a/core/mule.c +++ b/core/mule.c @@ -41,6 +41,17 @@ void uwsgi_mule(int id) { uwsgi_error("prctl()"); } #endif + + signal(SIGALRM, SIG_IGN); + signal(SIGHUP, SIG_IGN); + signal(SIGINT, end_me); + signal(SIGTERM, end_me); + signal(SIGUSR1, SIG_IGN); + signal(SIGUSR2, SIG_IGN); + signal(SIGPIPE, SIG_IGN); + signal(SIGSTOP, SIG_IGN); + signal(SIGTSTP, SIG_IGN); + uwsgi.muleid = id; // avoid race conditions uwsgi.mules[id - 1].id = id; diff --git a/core/spooler.c b/core/spooler.c index 45cfeb02..0c0626de 100644 --- a/core/spooler.c +++ b/core/spooler.c @@ -97,8 +97,18 @@ pid_t spooler_start(struct uwsgi_spooler * uspool) { exit(1); } else if (pid == 0) { + + signal(SIGALRM, SIG_IGN); + signal(SIGHUP, SIG_IGN); + signal(SIGINT, end_me); + signal(SIGTERM, end_me); // USR1 will be used to wake up the spooler uwsgi_unix_signal(SIGUSR1, spooler_wakeup); + signal(SIGUSR2, SIG_IGN); + signal(SIGPIPE, SIG_IGN); + signal(SIGSTOP, SIG_IGN); + signal(SIGTSTP, SIG_IGN); + uwsgi.mywid = -1; uwsgi.mypid = getpid(); uspool->pid = uwsgi.mypid; diff --git a/core/uwsgi.c b/core/uwsgi.c index 48298b8a..ce6a3205 100644 --- a/core/uwsgi.c +++ b/core/uwsgi.c @@ -1058,6 +1058,7 @@ void uwsgi_nuclear_blast() { } void reap_them_all(int signum) { + uwsgi_log("aooo\n"); int i; // avoid reace condition in lazy mode