]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mux-h2: Don't report error on SE for closed H2 streams
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 18 Dec 2023 17:24:49 +0000 (18:24 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 18 Dec 2023 20:15:32 +0000 (21:15 +0100)
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.

src/mux_h2.c

index d74a6bd130cc2e43d949b2ac8c1c37bb55489cba..6e4dc10391f4466b96dcbe6fbed7ae1856053a4a 100644 (file)
@@ -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)