BUG/MEDIUM: stconn: Forward shutdown on write timeout only if it is forwardable
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 5 Jan 2024 15:48:40 +0000 (16:48 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 5 Jan 2024 18:14:52 +0000 (19:14 +0100)
commit2b52339ac0fefd9561372e7a777f098dfa00ef1d
tree2f70589c9e42a3ad91e315e568a36b5fd19ca443
parentf2915cd5dd5105d41d459ceba8b414afb510d3a0
BUG/MEDIUM: stconn: Forward shutdown on write timeout only if it is forwardable

The commit b9c87f8082 ("BUG/MEDIUM: stconn/stream: Forward shutdown on write
timeout") introduced a regression. In sc_cond_forward_shut(), the write
timeout is considered too early to forward the shutdown. In fact, it is
always considered, even if the shutdown is not forwardable yet. It is of
course unexpected. It is especially an issue when a write timeout is
encountered on server side during the connection establishment. In this
case, if shutdown is forwarded too early on the client side, the connection
is closed before the 503 error sending.

So the write timeout must indeed be considered to forward the shutdown to
the underlying layer, but only if the shutdown is forwardable. Otherwise, we
should do nothing.

This patch should fix the issue #2404. It must be backported as far as 2.2.

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