]> 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 14:33:10 +0000 (16:33 +0200)
committerOlivier Houchard <cognet@ci0.org>
Fri, 14 Aug 2026 14:27:04 +0000 (16:27 +0200)
commitc5f41118c01db4babcf6919f5eae4ce308adcfef
treebe2f0420d90d7f3f8bbc476298c13f8c655fedca
parentcc0c18d82f2475507ef46a0f049bbd30d122807e
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.
src/haproxy.c
src/thread.c