From: Willy Tarreau Date: Thu, 31 Jan 2019 17:58:06 +0000 (+0100) Subject: BUG/MINOR: stream: don't close the front connection when facing a backend error X-Git-Tag: v2.0-dev1~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28e581b21c8229aa50b7e45148dd46fa6f43da5e;p=thirdparty%2Fhaproxy.git BUG/MINOR: stream: don't close the front connection when facing a backend error 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. --- diff --git a/src/stream.c b/src/stream.c index b66322752a..939c4dbc21 100644 --- a/src/stream.c +++ b/src/stream.c @@ -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;