BUG/MAJOR: tcpcheck: Allocate input and output buffers from the buffer pool
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 25 Nov 2020 12:47:00 +0000 (13:47 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 27 Nov 2020 09:29:41 +0000 (10:29 +0100)
commitb381a505c1010bb11abbe7b31e8d2307c4dab541
tree657780de433e97c416e2568c0f140fa00d56958d
parent39066c27384653b41b95370fc4dec4469a637a23
BUG/MAJOR: tcpcheck: Allocate input and output buffers from the buffer pool

Historically, the input and output buffers of a check are allocated by hand
during the startup, with a specific size (not necessarily the same than
other buffers). But since the recent refactoring of the checks to rely
exclusively on the tcp-checks and to use the underlying mux layer, this part
is totally buggy. Indeed, because these buffers are now passed to a mux,
they maybe be swapped if a zero-copy is possible. In fact, for now it is
only possible in h2_rcv_buf(). Thus the bug concretely only exists if a h2
health-check is performed. But, it is a latent bug for other muxes.

Another problem is the size of these buffers. because it may differ for the
other buffer size, it might be source of bugs.

Finally, for configurations with hundreds of thousands of servers, having 2
buffers per check always allocated may be an issue.

To fix the bug, we now allocate these buffers when required using the buffer
pool. Thus not-running checks don't waste memory and muxes may swap them if
possible. The only drawback is the check buffers have now always the same
size than buffers used by the streams. This deprecates indirectly the
"tune.chksize" global option.

In addition, the http-check regtest have been update to perform some h2
health-checks.

Many thanks to @VigneshSP94 for its help on this bug.

This patch should solve the issue #936. It relies on the commit "MINOR:
tcpcheck: Don't handle anymore in-progress send rules in tcpcheck_main".
Both must be backport as far as 2.2.

bla
include/haproxy/check-t.h
include/haproxy/check.h
reg-tests/checks/http-check.vtc
src/check.c
src/tcpcheck.c