From e77f4306bad59b1f1303838215461cbc03a15ffe Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 17 Jan 2023 16:27:35 +0100 Subject: [PATCH] BUG/MEDIUM: stconn: also consider SE_FL_EOI to switch to SE_FL_ERROR In se_fl_set_error() we used to switch to SE_FL_ERROR only when there is already SE_FL_EOS indicating that the read side is closed. But that is not sufficient, we need to consider all cases where no more reads will be performed on the connection, and as such also include SE_FL_EOI. Without this, some aborted connections during a transfer sometimes only stop after the timeout, because the ERR_PENDING is never promoted to ERROR. This must be backported to 2.7 and requires previous patch "CLEANUP: stconn: always use se_fl_set_error() to set the pending error". --- include/haproxy/stconn.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/haproxy/stconn.h b/include/haproxy/stconn.h index ff0de4354..067c71e02 100644 --- a/include/haproxy/stconn.h +++ b/include/haproxy/stconn.h @@ -99,7 +99,7 @@ static forceinline uint se_fl_get(const struct sedesc *se) /* sets SE_FL_ERROR or SE_FL_ERR_PENDING on the endpoint */ static inline void se_fl_set_error(struct sedesc *se) { - if (se_fl_test(se, SE_FL_EOS)) + if (se_fl_test(se, (SE_FL_EOS|SE_FL_EOI))) se_fl_set(se, SE_FL_ERROR); else se_fl_set(se, SE_FL_ERR_PENDING);