]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stream: don't close the front connection when facing a backend error
authorWilly Tarreau <w@1wt.eu>
Thu, 31 Jan 2019 17:58:06 +0000 (18:58 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 31 Jan 2019 18:38:25 +0000 (19:38 +0100)
In 1.5-dev13, a bug was introduced by commit e3224e870 ("BUG/MINOR:
session: ensure that we don't retry connection if some data were sent").
If a connection error is reported after some data were sent (and lost),
we used to accidently mark the front connection as being in error instead
of only the back one because the two direction flags were applied to the
same channel. This case is extremely rare with raw connections but can
happen a bit more often with multiplexed streams. This will result in
the error not being correctly reported to the client.

This patch can be backported to all supported versions.

src/stream.c

index b66322752afba5c2bebd12b89fe8979a95244f46..939c4dbc21aeef7201d90cf5c9f587ff4ad18dea 100644 (file)
@@ -640,7 +640,8 @@ static int sess_update_st_con_tcp(struct stream *s)
                         */
                        si->state    = SI_ST_EST;
                        si->err_type = SI_ET_DATA_ERR;
-                       rep->flags |= CF_READ_ERROR | CF_WRITE_ERROR;
+                       req->flags |= CF_WRITE_ERROR;
+                       rep->flags |= CF_READ_ERROR;
                        return 1;
                }
                si->exp   = TICK_ETERNITY;