]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: checks: make sure to always apply offsets to now_ms in expiration
authorWilly Tarreau <w@1wt.eu>
Fri, 15 Nov 2024 14:34:46 +0000 (15:34 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 Nov 2024 14:39:00 +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 health checks suddenly stopping.

This should be backported where it applies.

src/check.c
src/extcheck.c

index 1474a55f9dfc50ff71db8390914cacc9f54899d5..85691de87e8ea940a2e00722e28204e91c9c82aa 100644 (file)
@@ -1279,7 +1279,7 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state)
                 * was erased during the bounce.
                 */
                if (!tick_isset(t->expire)) {
-                       t->expire = now_ms;
+                       t->expire = tick_add(now_ms, 0);
                        expired = 0;
                }
        }
index c71639cd5f37bb2766b2e2248d4dda31ec8e8d7c..152acaddc794748eb23f7a44b77fed809ff5f9f0 100644 (file)
@@ -162,7 +162,7 @@ static void pid_list_expire(pid_t pid, int status)
        HA_SPIN_LOCK(PID_LIST_LOCK, &pid_list_lock);
        list_for_each_entry(elem, &pid_list, list) {
                if (elem->pid == pid) {
-                       elem->t->expire = now_ms;
+                       elem->t->expire = tick_add(now_ms, 0);
                        elem->status = status;
                        elem->exited = 1;
                        task_wakeup(elem->t, TASK_WOKEN_IO);