MINOR: connection: add more connection error codes to cover common errno
authorWilly Tarreau <w@1wt.eu>
Tue, 5 Nov 2024 16:49:15 +0000 (17:49 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 6 Nov 2024 18:04:38 +0000 (19:04 +0100)
commit6200536920ed893a89c416e1347a4545f82153e9
treeb7ccec548ddaf7fa4b1eb2fd389397893de2da52
parentaa35557e76bac47fa81e271c5c3d2a566ce56bb3
MINOR: connection: add more connection error codes to cover common errno

While we get reports of connection setup errors in fc_err/bc_err, we
don't have the equivalent for the recv/send/splice syscalls. Let's
add provisions for new codes that cover the common errno values that
recv/send/splice can return, i.e. ECONNREFUSED, ENOMEM, EBADF, EFAULT,
EINVAL, ENOTCONN, ENOTSOCK, ENOBUFS, EPIPE. We also add a special case
for when the poller reported the error itself. It's worth noting that
EBADF/EFAULT/EINVAL will generally indicate serious bugs in the code
and should not be reported.

The only thing is that it's quite hard to forcefully (and reliably)
trigger these errors in automated tests as the timing is critical.
Using iptables to manually reset established connections in the
middle of large transfers at least permits to see some ECONNRESET
and/or EPIPE, but the other ones are harder to trigger.

(cherry picked from commit 00c383ff65c6378327382d2c055f66efb098498d)
Signed-off-by: Willy Tarreau <w@1wt.eu>
doc/configuration.txt
include/haproxy/connection-t.h
include/haproxy/connection.h
src/connection.c