diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-03-28 16:37:50 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-03-28 16:37:50 +0000 |
commit | 192c6b791d1c2b42861df6526c663f1d0814ee84 (patch) | |
tree | ed75147db4aa301befe8bc510911e67998a0dcdc /src/rspamd.c | |
parent | 0e1e5111e3aea32e6e001c0b55d43493bac04738 (diff) | |
download | rspamd-192c6b791d1c2b42861df6526c663f1d0814ee84.tar.gz rspamd-192c6b791d1c2b42861df6526c663f1d0814ee84.zip |
[Minor] Try harder to avoid races on child termination
Diffstat (limited to 'src/rspamd.c')
-rw-r--r-- | src/rspamd.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/rspamd.c b/src/rspamd.c index 70aed4331..20dc06bdc 100644 --- a/src/rspamd.c +++ b/src/rspamd.c @@ -769,6 +769,7 @@ kill_old_workers (gpointer key, gpointer value, gpointer unused) w->state = rspamd_worker_state_terminating; kill (w->pid, SIGUSR2); ev_io_stop (rspamd_main->event_loop, &w->srv_ev); + g_hash_table_remove_all (w->control_events_pending); msg_info_main ("send signal to worker %P", w->pid); } else { @@ -1141,6 +1142,8 @@ rspamd_cld_handler (EV_P_ ev_child *w, struct rspamd_main *rspamd_main, /* Remove dead child form children list */ g_hash_table_remove (rspamd_main->workers, GSIZE_TO_POINTER (wrk->pid)); + g_hash_table_remove_all (wrk->control_events_pending); + if (wrk->srv_pipe[0] != -1) { /* Ugly workaround */ if (wrk->tmp_data) { |