]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: h2: don't consider pending data on detach if connection is in error
authorWilly Tarreau <w@1wt.eu>
Thu, 29 Mar 2018 13:41:32 +0000 (15:41 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 29 Mar 2018 13:41:32 +0000 (15:41 +0200)
Interrupting an h2load test shows that some connections remain active till
the client timeout. This is due to the fact that h2_detach() immediately
returns if the h2s flags indicate that the h2s is still waiting for some
buffer room in the output mux (possibly to emit a response or to send some
window updates). If the connection is broken, these data will never leave
and must not prevent the stream from being terminated nor the connection
from being released.

This fix must be backported to 1.8.

src/mux_h2.c

index 8a0c4a3301f11e7eb8ca235db7ad9c47d961ed10..03f6e0e41be83110c6b11591cc6a871bff2aba91 100644 (file)
@@ -2447,7 +2447,8 @@ static void h2_detach(struct conn_stream *cs)
        /* this stream may be blocked waiting for some data to leave (possibly
         * an ES or RST frame), so orphan it in this case.
         */
-       if (h2s->flags & (H2_SF_BLK_MBUSY | H2_SF_BLK_MROOM | H2_SF_BLK_MFCTL))
+       if (!(cs->conn->flags & CO_FL_ERROR) &&
+           (h2s->flags & (H2_SF_BLK_MBUSY | H2_SF_BLK_MROOM | H2_SF_BLK_MFCTL)))
                return;
 
        if ((h2c->flags & H2_CF_DEM_BLOCK_ANY && h2s->id == h2c->dsi) ||