From 915ba08b57b5dfc8d7c17edb6ff1714bc9411248 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 12 Apr 2023 18:23:15 +0200 Subject: [PATCH] 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. --- src/stream.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/stream.c b/src/stream.c index cbcdfefb4..ae92b1842 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);