BUG/MINOR: sink: add tempo between 2 connection attempts for sft servers
authorAurelien DARRAGON <adarragon@haproxy.com>
Fri, 21 Feb 2025 09:51:01 +0000 (10:51 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 28 Feb 2025 15:22:45 +0000 (16:22 +0100)
commit0164f13cb144fff527b970a6f19175ccd627980c
tree01533c64965ec22ffc3c541fee6cd9b2305819df
parentca0062d303b31d85d363a1322f1b4eff905df032
BUG/MINOR: sink: add tempo between 2 connection attempts for sft servers

When the connection for sink_forward_{oc}_applet fails or a previous one
is destroyed, the sft->appctx is instantly released.

However process_sink_forward_task(), which may run at any time, iterates
over all known sfts and tries to create sessions for orphan ones.

It means that instantly after sft->appctx is destroyed, a new one will
be created, thus a new connection attempt will be made.

It can be an issue with tcp log-servers or sink servers, because if the
server is unavailable, process_sink_forward() will keep looping without
any temporisation until the applet survives (ie: connection succeeds),
which results in unexpected CPU usage on the threads responsible for
that task.

Instead, we add a tempo logic so that a delay of 1second is applied
between two retries. Of course the initial attempt is not delayed.

This could be backported to all stable versions.

(cherry picked from commit 9561b9fb6964af325a10e7128b563114f144a3cb)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
include/haproxy/sink-t.h
src/sink.c