]> git.ipfire.org Git - thirdparty/haproxy.git/commit
DEBUG: connection: mark the closed FDs with a value that is easier to detect
authorWilly Tarreau <w@1wt.eu>
Thu, 17 Nov 2016 13:22:52 +0000 (14:22 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 18 Nov 2016 14:00:42 +0000 (15:00 +0100)
commit733b1327a698158f3ac34231f7bf3a7bfdf6a719
tree2c88710b91f8662dbc779bc2f3933499ce20d221
parent350135cf49023a8f3f5b12b406a3dd7b9b1579bc
DEBUG: connection: mark the closed FDs with a value that is easier to detect

Setting an FD to -1 when closed isn't the most easily noticeable thing
to do when we're chasing accidental reuse of a stale file descriptor.
Instead set it to that large a negative value that it will overflow the
fdtab and provide an analysable core at the moment the issue happens.
Care was taken to ensure it doesn't overflow nor change sign on 32-bit
machines when multiplied by fdtab, and that it also remains negative for
the various checks that exist. The value equals 0xFDDEADFD which happens
to be easily spotted in a debugger.
include/proto/connection.h
include/types/fd.h
src/dumpstats.c