BUG/MEDIUM: h2: don't consider pending data on detach if connection is in error

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.
This commit is contained in:
Willy Tarreau 2018-03-29 15:41:32 +02:00
parent 0975f11d55
commit 3041fcc2fd

View 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 /* this stream may be blocked waiting for some data to leave (possibly
* an ES or RST frame), so orphan it in this case. * 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; return;
if ((h2c->flags & H2_CF_DEM_BLOCK_ANY && h2s->id == h2c->dsi) || if ((h2c->flags & H2_CF_DEM_BLOCK_ANY && h2s->id == h2c->dsi) ||