Skip to content

Commit 2f287f1

Browse files
committed
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.
1 parent 555994c commit 2f287f1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/check.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,7 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state)
12791279
* was erased during the bounce.
12801280
*/
12811281
if (!tick_isset(t->expire)) {
1282-
t->expire = now_ms;
1282+
t->expire = tick_add(now_ms, 0);
12831283
expired = 0;
12841284
}
12851285
}

src/extcheck.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ static void pid_list_expire(pid_t pid, int status)
162162
HA_SPIN_LOCK(PID_LIST_LOCK, &pid_list_lock);
163163
list_for_each_entry(elem, &pid_list, list) {
164164
if (elem->pid == pid) {
165-
elem->t->expire = now_ms;
165+
elem->t->expire = tick_add(now_ms, 0);
166166
elem->status = status;
167167
elem->exited = 1;
168168
task_wakeup(elem->t, TASK_WOKEN_IO);

0 commit comments

Comments
 (0)