BUG/MINOR: stream: Properly handle "on-marked-up shutdown-backup-sessions"
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 27 Jan 2025 15:17:27 +0000 (16:17 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 28 Jan 2025 14:20:42 +0000 (15:20 +0100)
commit3dd155172926bf3c65a0f58e76bb9f285e7578a9
tree99ecf65fbc57eb1a61eb1ac9c1f7790c0689b1a4
parentfb906d7bc66f9e6dcd1d0687b0e2767fce2a0125
BUG/MINOR: stream: Properly handle "on-marked-up shutdown-backup-sessions"

shutdown-backup-sessions action for on-marked-up directive does not work anymore
since the stream_shutdown() function was modified to be async-safe.

When stream_shutdown() was modified to be async-safe, dedicated task events were
added to map the reasons to shut a stream down. SF_ERR_DOWN was mapped to
TASK_F_EVT1 and SF_ERR_KILLED was mapped to TASK_F_EVT2. The reverse mapping was
performed by process_stream() to shut the stream with the appropriate reason.

However, SF_ERR_UP reason, used by shutdown-backup-sessions action to shut a
stream down because a preferred server became available, was not mapped in the
same way. So since commit b8e3b0a18d ("BUG/MEDIUM: stream: make
stream_shutdown() async-safe"), this action is ignored and does not work
anymore.

To fix an issue, and being able to bakcport the fix, a third task event was
added. TASK_F_EVT3 is now mapped on SF_ERR_UP.

This patch should fix the issue #2848. It must be backported as far as 2.6.

(cherry picked from commit 0a52a75ef7151a187b42cae6d49a75b79380f211)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 07a8dd887f412078842e16b016fbd8dd61063306)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
doc/internals/api/scheduler.txt
include/haproxy/stream.h
include/haproxy/task-t.h
src/stream.c