summaryrefslogtreecommitdiffstats
path: root/src/rspamd.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-24 11:28:17 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-24 11:28:17 +0000
commit2376a87e73c05e5db8d9eef3ab1edc0dcde4c9ab (patch)
tree4599dca97aeb5234aa802ebf3a9c269b107e0ba7 /src/rspamd.c
parent55f6b6016912142b03a075f32076709f850707b0 (diff)
downloadrspamd-2376a87e73c05e5db8d9eef3ab1edc0dcde4c9ab.tar.gz
rspamd-2376a87e73c05e5db8d9eef3ab1edc0dcde4c9ab.zip
[Fix] Do not refork workers that are intended to die
Diffstat (limited to 'src/rspamd.c')
-rw-r--r--src/rspamd.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/rspamd.c b/src/rspamd.c
index 44931dfda..c00faa056 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",