mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-17 20:46:58 +02:00
[BUG] task: fix possible timer drift after update
When the scheduler detected that a task was misplaced in the timer
queue, it used to place it right again. Unfortunately, it did not
check whether it would still call the new task from its new place.
This resulted in some tasks not getting called on timeout once in
a while, causing a minor drift for repetitive timers. This effect
was only observable with slow health checks and without any activity
because no other task would cause the scheduler to be immediately
called again.
In practice, it does not affect any real-world configuration, but
it's still better to fix it.
(cherry picked from commit 814c978fb6
)
This commit is contained in:
parent
7cf930b2dd
commit
4de2dea807
@ -152,10 +152,14 @@ void wake_expired_tasks(int *next)
|
||||
* lot cheaper to proceed like this because we almost never update
|
||||
* the tree. We may also find disabled expiration dates there. Since
|
||||
* we have detached the task from the tree, we simply call task_queue
|
||||
* to take care of this.
|
||||
* to take care of this. Note that we might occasionally requeue it at
|
||||
* the same place, before <eb>, so we have to check if this happens,
|
||||
* and adjust <eb>, otherwise we may skip it which is not what we want.
|
||||
*/
|
||||
if (!tick_is_expired(task->expire, now_ms)) {
|
||||
task_queue(task);
|
||||
if (!eb || eb->key > task->wq.key)
|
||||
eb = &task->wq;
|
||||
continue;
|
||||
}
|
||||
task_wakeup(task, TASK_WOKEN_TIMER);
|
||||
|
Loading…
Reference in New Issue
Block a user