BUG/MEDIUM: h2: automatically set CS_FL_RCV_MORE when the output buffer is full

If we can't demux pending data due to a stream buffer full condition, we
now set CS_FL_RCV_MORE on the conn_stream so that the stream layer knows
it must call back as soon as possible to restart demuxing. Without this,
some uploaded payloads are truncated if the server does not consume them
fast enough and buffers fill up.

Note that this is still not enough to solve the problem, some changes are
required on the recv() and update_poll() paths to allow to restart reading
even with a buffer full condition.

This patch must be backported to 1.8.
This commit is contained in:
Willy Tarreau 2017-12-10 21:28:43 +01:00
parent 6577b48613
commit c9ede6c43e

View File

@ -2611,6 +2611,8 @@ static int h2_frt_transfer_data(struct h2s *h2s, struct buffer *buf, int count)
unsigned int padlen = 0; unsigned int padlen = 0;
int offset = 0; int offset = 0;
h2s->cs->flags &= ~CS_FL_RCV_MORE;
if (h2c->dbuf->i < flen) if (h2c->dbuf->i < flen)
return 0; return 0;
@ -2631,6 +2633,7 @@ static int h2_frt_transfer_data(struct h2s *h2s, struct buffer *buf, int count)
/* does it fit in output buffer or should we wait ? */ /* does it fit in output buffer or should we wait ? */
if (buf->i + buf->o + flen > buf->size) { if (buf->i + buf->o + flen > buf->size) {
h2c->flags |= H2_CF_DEM_SFULL; h2c->flags |= H2_CF_DEM_SFULL;
h2s->cs->flags |= CS_FL_RCV_MORE;
return 0; return 0;
} }