From: Vsevolod Stakhov Date: Tue, 24 Jan 2017 11:28:17 +0000 (+0000) Subject: [Fix] Do not refork workers that are intended to die X-Git-Tag: 1.5.0~273 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2376a87e73c05e5db8d9eef3ab1edc0dcde4c9ab;p=thirdparty%2Frspamd.git [Fix] Do not refork workers that are intended to die --- diff --git a/src/rspamd.c b/src/rspamd.c index 44931dfdab..c00faa056c 100644 --- a/src/rspamd.c +++ b/src/rspamd.c @@ -656,8 +656,15 @@ kill_old_workers (gpointer key, gpointer value, gpointer unused) struct rspamd_main *rspamd_main; rspamd_main = w->srv; - kill (w->pid, SIGUSR2); - msg_info_main ("send signal to worker %P", w->pid); + + if (!w->wanna_die) { + w->wanna_die = TRUE; + kill (w->pid, SIGUSR2); + msg_info_main ("send signal to worker %P", w->pid); + } + else { + msg_info_main ("do not send signal to worker %P, already sent", w->pid); + } } static gboolean @@ -942,6 +949,11 @@ rspamd_cld_handler (gint signo, short what, gpointer arg) g_hash_table_remove (rspamd_main->workers, GSIZE_TO_POINTER ( wrk)); + if (cur->wanna_die) { + /* Do not refork workers that are intended to be terminated */ + need_refork = FALSE; + } + if (WIFEXITED (res) && WEXITSTATUS (res) == 0) { /* Normal worker termination, do not fork one more */ msg_info_main ("%s process %P terminated normally",