]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: wdt: fix the stuck detection for warnings
authorWilly Tarreau <w@1wt.eu>
Thu, 21 Nov 2024 18:11:18 +0000 (19:11 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 21 Nov 2024 18:58:05 +0000 (19:58 +0100)
commit24ce001771a7609b2a3902fc1f851668ef176c59
tree22aec1a0c7935caec9915402f58054beec0b529c
parent1151fe68186cf862882f147de208c509c25d525e
BUG/MEDIUM: wdt: fix the stuck detection for warnings

If two slow tasks trigger one warning even a few seconds apart, the
watchdog code will mistakenly take this for a definite stuck task and
kill the process. The reason is that since commit 148eb5875f ("DEBUG:
wdt: better detect apparently locked up threads and warn about them")
the updated ctxsw count is not the correct one, instead of updating
the private counter it resets the public one, preventing it from making
progress and making the wdt believe that no progress was made. In
addition the initial value was read from [tid] instead of [thr].

Please note that another fix is needed in debug_handler() otherwise the
watchdog will fire early after the first warning or thread dump.

A simple test for this is to issue several of these commands back-to-back
on the CLI, which crashes an unfixed 3.1 very quickly:

  $ socat /tmp/sock1 - <<< "expert-mode on; debug dev loop 1000"

This needs to be backported to 2.9 since the fix above was backported
there. The impact on 3.0 and 2.9 is almost inexistent since the watchdog
there doesn't apply the shorter warning delay, so the first call already
indicates that the thread is stuck.
src/wdt.c