]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mailers: make sure to always apply offsets to now_ms in expiration
authorWilly Tarreau <w@1wt.eu>
Fri, 15 Nov 2024 14:39:58 +0000 (15:39 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 Nov 2024 14:39:58 +0000 (15:39 +0100)
Now_ms can be zero nowadays, so it's not suitable for direct assignment to
t->expire, as there's a risk that the timer never wakes up once assigned
(TICK_ETERNITY). Let's use tick_add(now_ms, 0) for an immediate wakeup
instead. The impact here might be mailers suddenly stopping.

This should be backported where it applies.

src/mailers.c

index 50f1e76d3bcb42851d0d50e6c92c31152dccc714..1e61842f4f73c338283cde5b7c11a942f066b64b 100644 (file)
@@ -80,7 +80,7 @@ static struct task *process_email_alert(struct task *t, void *context, unsigned
 
                        alert = LIST_NEXT(&q->email_alerts, typeof(alert), list);
                        LIST_DELETE(&alert->list);
-                       t->expire             = now_ms;
+                       t->expire             = tick_add(now_ms, 0);
                        check->tcpcheck_rules = &alert->rules;
                        check->status         = HCHK_STATUS_INI;
                        check->state         |= CHK_ST_ENABLED;