From: Christopher Faulet Date: Mon, 18 Dec 2023 17:24:49 +0000 (+0100) Subject: BUG/MEDIUM: mux-h2: Don't report error on SE for closed H2 streams X-Git-Tag: v3.0-dev1~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d9eb6d6680c4baccaced3668f8b0c7fc19246fd1;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: mux-h2: Don't report error on SE for closed H2 streams An error on the H2 connection was always reported as an error to the stream-endpoint descriptor, independently on the H2 stream state. But it is a bug to do so for closed streams. And indeed, it leads to report "SD--" termination state for some streams while the response was fully received and forwarded to the client, at least for the backend side point of view. Now, errors are no longer reported for H2 streams in closed state. This patch is related to the three previous ones: * "BUG/MEDIUM: mux-h2: Don't report error on SE for closed H2 streams" * "BUG/MEDIUM: mux-h2: Don't report error on SE if error is only pending on H2C" * "BUG/MEDIUM: mux-h2: Only Report H2C error on read error if demux buffer is empty" The series should fix a bug reported in issue #2388 (#2388#issuecomment-1855735144). The series should be backported to 2.9 but only after a period of observation. In theory, older versions are also affected but this part is pretty sensitive. So don't backport it further except if someone ask for it. --- diff --git a/src/mux_h2.c b/src/mux_h2.c index d74a6bd130..6e4dc10391 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -2178,8 +2178,9 @@ static void h2s_wake_one_stream(struct h2s *h2s) h2s_close(h2s); } - if (h2s->h2c->st0 >= H2_CS_ERROR || (h2s->h2c->flags & H2_CF_ERROR) || - (h2s->h2c->last_sid > 0 && (!h2s->id || h2s->id > h2s->h2c->last_sid))) { + if ((h2s->st != H2_SS_CLOSED) && + (h2s->h2c->st0 >= H2_CS_ERROR || (h2s->h2c->flags & H2_CF_ERROR) || + (h2s->h2c->last_sid > 0 && (!h2s->id || h2s->id > h2s->h2c->last_sid)))) { se_fl_set_error(h2s->sd); if (h2s->st < H2_SS_ERROR)