]> git.kaiwu.me - haproxy.git/commit
DEBUG: fd: catch access attempts to closed FDs
authorWilly Tarreau <w@1wt.eu>
Fri, 24 Jul 2026 09:31:12 +0000 (11:31 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 24 Jul 2026 09:33:44 +0000 (11:33 +0200)
commitd77f75b508d9781174c9f145f600c809b886f03d
tree026acc09869ef47862df8ccce5614a97c02ff2d5
parent34b9b528e83e864170a773c66afc0cbca687c475
DEBUG: fd: catch access attempts to closed FDs

Certain rare bugs may cause an fd_want_recv() or any of the other
operations being done on a closed FD. This triggers a BUG_ON() on the
next call trying to insert the FD but it's too late to figure when
this happened. Let's just add some BUG_ON_HOT() to detect an attempt
to modify the state of a closed FD so that the culprit is detected.

It will only be enabled with DEBUG_STRICT=2, since by design this may
never happen so it's not needed to enable it in default builds. It was
verified not to trigger on various tests.
include/haproxy/fd.h