From 2f287f14f355e734e512732e35aebf993d000792 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 15 Nov 2024 15:34:46 +0100 Subject: [PATCH] BUG/MEDIUM: checks: make sure to always apply offsets to now_ms in expiration 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 | 2 +- src/extcheck.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/check.c b/src/check.c index 1474a55f9..85691de87 100644 --- a/src/check.c +++ b/src/check.c @@ -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; } } diff --git a/src/extcheck.c b/src/extcheck.c index c71639cd5..152acaddc 100644 --- a/src/extcheck.c +++ b/src/extcheck.c @@ -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);