From 28e581b21c8229aa50b7e45148dd46fa6f43da5e Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 31 Jan 2019 18:58:06 +0100 Subject: [PATCH] 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. --- src/stream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/stream.c b/src/stream.c index b66322752..939c4dbc2 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;