]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: tasks: don't type-pun state and tid in builds without threads
authorOlivier Houchard <ohouchard@haproxy.com>
Fri, 14 Aug 2026 16:59:44 +0000 (18:59 +0200)
committerOlivier Houchard <cognet@ci0.org>
Tue, 18 Aug 2026 12:24:03 +0000 (14:24 +0200)
commitccb44533c0150cd66e31479cbcfdff679606a9b1
tree8457f8e31cb6cbfeeb7eea7e847699845f5b8c6d
parent4a8f762204bba85064a8b1c4355f56d4b857787c
BUG/MEDIUM: tasks: don't type-pun state and tid in builds without threads

__task_set_state_and_tid() updates t->state and t->tid at once through
an uint64_t cast, which violates strict aliasing. With threads the
__atomic builtins keep the compiler conservative, but without them the
accesses are plain, and gcc -O2 legitimately keeps using a stale
t->state: the CAS always fails and _task_wakeup() spins forever on the
first request until the watchdog kills the process.

Without threads there is no concurrency to protect against, so just
compare and assign the two fields directly.

This is what commit c5f41118c01db4babcf6919f5eae4ce308adcfef should have
been.
include/haproxy/task.h