BUG/MEDIUM: spoe: Fix policy to close applets when SPOE connections are queued
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 2 Aug 2021 16:13:27 +0000 (18:13 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 12 Aug 2021 15:09:53 +0000 (17:09 +0200)
commitad623171097dd18905bcf26b81581b56fe7af9b1
tree9292cc9463f7e9ab60d92f06efc0896a35b7a110
parent7be786fcd90647aff2bf502d4c5b89483cf8490a
BUG/MEDIUM: spoe: Fix policy to close applets when SPOE connections are queued

It is the second part of the fix that should solve fairness issues with the
connections management inside the SPOE filter. Indeed, in multithreaded
mode, when the SPOE detects there are some connections in queue on a server,
it closes existing connections by releasing SPOE applets. It is mandatory
when a maxconn is set because few connections on a thread may prenvent new
connections establishment.

The first attempt to fix this bug (9e647e5af "BUG/MEDIUM: spoe: Kill applets
if there are pending connections and nbthread > 1") introduced a bug. In
pipelining mode, SPOE applets might be closed while some frames are pending
for the ACK reply. To fix the bug, in the processing stage, if there are
some connections in queue, only truly idle applets may process pending
requests. In this case, only one request at a time is processed. And at the
end of the processing stage, only truly idle applets may be released. It is
an empirical workaround, but it should be good enough to solve contention
issues when a low maxconn is set.

This patch should partely fix the issue #1340. It must be backported as far
as 2.0.

(cherry picked from commit d7da3dd928b4bc71c1c207908c455b81d2514676)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit f028bb62471ffb3ea2976398c8086ca8ac4c0cb6)
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/flt_spoe.c