{
gboolean need_refork = TRUE;
- if (wrk->state != rspamd_worker_state_running || rspamd_main->wanna_die) {
+ if (wrk->state != rspamd_worker_state_running || rspamd_main->wanna_die ||
+ (wrk->flags & RSPAMD_WORKER_OLD_CONFIG)) {
/* 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 */
- if (wrk->hb.nbeats < 0 && rspamd_main->cfg->heartbeats_loss_max > 0 &&
- -(wrk->hb.nbeats) >= rspamd_main->cfg->heartbeats_loss_max) {
- msg_info_main ("%s process %P terminated normally, but lost %L "
- "heartbeats, refork it",
- g_quark_to_string (wrk->type),
- wrk->pid,
- -(wrk->hb.nbeats));
- need_refork = TRUE;
- }
- else {
+ if (wrk->flags & RSPAMD_WORKER_OLD_CONFIG) {
+ /* Never re-fork old workers */
msg_info_main ("%s process %P terminated normally",
- g_quark_to_string (wrk->type),
+ g_quark_to_string(wrk->type),
wrk->pid);
need_refork = FALSE;
}
+ else {
+ if (wrk->hb.nbeats < 0 && rspamd_main->cfg->heartbeats_loss_max > 0 &&
+ -(wrk->hb.nbeats) >= rspamd_main->cfg->heartbeats_loss_max) {
+ msg_info_main ("%s process %P terminated normally, but lost %L "
+ "heartbeats, refork it",
+ g_quark_to_string(wrk->type),
+ wrk->pid,
+ -(wrk->hb.nbeats));
+ need_refork = TRUE;
+ }
+ else {
+ msg_info_main ("%s process %P terminated normally",
+ g_quark_to_string(wrk->type),
+ wrk->pid);
+ need_refork = FALSE;
+ }
+ }
}
else {
if (WIFSIGNALED (res)) {
mark_old_workers (gpointer key, gpointer value, gpointer unused)
{
struct rspamd_worker *w = value;
- struct rspamd_main __attribute__ ((unused)) *rspamd_main;
-
- rspamd_main = w->srv;
if (w->state == rspamd_worker_state_running) {
w->state = rspamd_worker_state_wanna_die;
}
+
+ w->flags |= RSPAMD_WORKER_OLD_CONFIG;
}
static void
RSPAMD_WORKER_SCANNER = (1 << 5),
RSPAMD_WORKER_CONTROLLER = (1 << 6),
RSPAMD_WORKER_NO_TERMINATE_DELAY = (1 << 7),
+ RSPAMD_WORKER_OLD_CONFIG = (1 << 8),
};
struct rspamd_worker_accept_event {