From c54e4b053d46a2ee80da261bc48858165cbe2aaf Mon Sep 17 00:00:00 2001 From: Christopher Faulet <cfaulet@haproxy.com> Date: Fri, 19 Apr 2019 15:03:19 +0200 Subject: [PATCH] BUG/MEDIUM: stream: Don't request a server connection if a shutw was scheduled If a shutdown for writes was performed on the client side (CF_SHUTW is set on the request channel) while the server connection is still unestablished (the stream-int is in the state SI_ST_INI), then it is aborted. It must also be aborted when the shudown for write is pending (only CF_SHUTW_NOW is set). Otherwise, some errors on the request channel can be ignored, leaving the stream in an undefined state. This patch must be backported to 1.9. It may probably be backported to all suported versions, but it is unclear if the bug is visbile for older versions than 1.9. So it is probably safer to wait bug reports on these versions to backport this patch. --- src/stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stream.c b/src/stream.c index 3762f1bbd..774028945 100644 --- a/src/stream.c +++ b/src/stream.c @@ -2267,7 +2267,7 @@ redo: * - the CF_AUTO_CONNECT flag is set (active connection) */ if (si_b->state == SI_ST_INI) { - if (!(req->flags & CF_SHUTW)) { + if (!(req->flags & (CF_SHUTW|CF_SHUTW_NOW))) { if ((req->flags & CF_AUTO_CONNECT) || !channel_is_empty(req)) { /* If we have an appctx, there is no connect method, so we * immediately switch to the connected state, otherwise we