BUG/MINOR: checks: do not queue/wake a bounced check

A small issue was introduced with commit d114f4a68 ("MEDIUM: checks:
spread the checks load over random threads"): when a check is bounced
to another thread, its expiration time is set to TICK_ETERNITY. This
makes it show as not expired upon first wakeup on the next thread,
thus being detected as "woke up too early" and being instantly
rescheduled. Only this after this next wakeup it will be properly
considered.

Several approaches were attempted to fix this. The best one seems to
consist in resetting t->expire and expired upon wakeup, and changing
the !expired test for !tick_is_expired() so that we don't trigger on
this case.

This needs to be backported to 2.7.
This commit is contained in:
Willy Tarreau 2023-09-01 07:41:46 +02:00
parent 338431ecb6
commit 48442b8b15

View File

@ -1167,8 +1167,10 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state)
* needs an expiration timer that was supposed to be now, but that
* was erased during the bounce.
*/
if (!tick_isset(t->expire))
if (!tick_isset(t->expire)) {
t->expire = now_ms;
expired = 0;
}
}
if (unlikely(check->state & CHK_ST_PURGE)) {
@ -1180,7 +1182,7 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state)
* new state (e.g. fastinter), in which case we'll reprogram
* the new timer.
*/
if (!expired) /* woke up too early */ {
if (!tick_is_expired(t->expire, now_ms)) { /* woke up too early */
if (check->server) {
int new_exp = tick_add(now_ms, MS_TO_TICKS(srv_getinter(check)));