From: Christopher Faulet Date: Wed, 12 Apr 2023 16:23:15 +0000 (+0200) Subject: BUG/MEDIUM: stream: Report write timeouts before testing the flags X-Git-Tag: v2.8-dev8~162 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=915ba08b57b5dfc8d7c17edb6ff1714bc9411248;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: stream: Report write timeouts before testing the flags A regression was introduced when stream's timeouts were refactored. Write timeouts are not testing is the right order. When timeous of the front SC are handled, we must then test the read timeout on the request channel and the write timeout on the response channel. But write timeout is tested on the request channel instead. On the back SC, the same mix-up is performed. We must be careful to handle timeouts before checking channel flags. To avoid any confusions, all timeuts are handled first, on front and back SCs. Then flags of the both channels are tested. It is a 2.8-specific issue. No backport needed. --- diff --git a/src/stream.c b/src/stream.c index cbcdfefb49..ae92b18425 100644 --- a/src/stream.c +++ b/src/stream.c @@ -1578,6 +1578,9 @@ static void stream_handle_timeouts(struct stream *s) sc_check_timeouts(s->scf); channel_check_timeout(&s->req); + sc_check_timeouts(s->scb); + channel_check_timeout(&s->res); + if (unlikely(!(s->scb->flags & SC_FL_SHUTW) && (s->req.flags & CF_WRITE_TIMEOUT))) { s->scb->flags |= SC_FL_NOLINGER; sc_shutw(s->scb); @@ -1588,9 +1591,6 @@ static void stream_handle_timeouts(struct stream *s) s->scf->flags |= SC_FL_NOLINGER; sc_shutr(s->scf); } - - sc_check_timeouts(s->scb); - channel_check_timeout(&s->res); if (unlikely(!(s->scf->flags & SC_FL_SHUTW) && (s->res.flags & CF_WRITE_TIMEOUT))) { s->scf->flags |= SC_FL_NOLINGER; sc_shutw(s->scf);