]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MAJOR: tasks: don't requeue global tasks into the local queue
authorWilly Tarreau <w@1wt.eu>
Wed, 22 Jul 2020 12:12:45 +0000 (14:12 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 22 Jul 2020 12:12:45 +0000 (14:12 +0200)
commit783afbe93b15da8093424cd116c06171f696ae2f
treec85ee3dc0661b4f922dd5cf8cf72b18a7b5c5132
parentd3db3846c5d2f3a2a27a6055d28d146838b7189d
BUG/MAJOR: tasks: don't requeue global tasks into the local queue

A bug was introduced by commit 77015abe0 ("MEDIUM: tasks: clean up the
front side of the wait queue in wake_expired_tasks()"): front tasks
that are not yet expired were incorrectly requeued into the local
wait queue instead of the global one. Because of this, the same task
could be found by the same thread on next invocation and be unlinked
without locking, allowing another thread to requeue it in parallel,
and conversely another thread could unlink it while the task was being
walked over, causing all sorts of crashes and endless loops in
wake_expired_tasks() and affiliates.

This bug can easily be triggered by stressing the do_resolve action
in multi-thread (after applying the fixes required to get do_resolve
to work with threads). It certainly is the cause of issue #758.

This must be backported to 2.2 only.
src/task.c