BUG/MEDIUM: mux-h1: Don't skip the TCP splicing when there is no more data to read

When there is no more data to read (h1m->curr_len == 0 in the state
H1_MSG_DATA), we still call xprt->rcv_pipe() callback. It is important to update
connection's flags. Especially to remove the flag CO_FL_WAIT_ROOM. Otherwise,
the pipe remains marked as full, preventing the stream-interface to fallback on
rcv_buf(). So the connection may be freezed because no more data is received and
the mux H1 remains blocked in the state H1_MSG_DATA.

This patch must be backported to 1.9.
This commit is contained in:
Christopher Faulet 2019-05-29 14:35:24 +02:00 committed by Willy Tarreau
parent 1e928c074b
commit 1146f975a9

View File

@ -2312,10 +2312,10 @@ static int h1_rcv_pipe(struct conn_stream *cs, struct pipe *pipe, unsigned int c
struct h1m *h1m = (!conn_is_back(cs->conn) ? &h1s->req : &h1s->res); struct h1m *h1m = (!conn_is_back(cs->conn) ? &h1s->req : &h1s->res);
int ret = 0; int ret = 0;
if ((h1m->state != H1_MSG_DATA && h1m->state != H1_MSG_TUNNEL) || if (h1m->state != H1_MSG_DATA && h1m->state != H1_MSG_TUNNEL) {
(h1m->state == H1_MSG_DATA && !h1m->curr_len)) {
h1s->flags &= ~(H1S_F_BUF_FLUSH|H1S_F_SPLICED_DATA); h1s->flags &= ~(H1S_F_BUF_FLUSH|H1S_F_SPLICED_DATA);
cs->conn->xprt->subscribe(cs->conn, cs->conn->xprt_ctx, SUB_RETRY_RECV, &h1s->h1c->wait_event); if (!(h1s->h1c->wait_event.events & SUB_RETRY_RECV))
cs->conn->xprt->subscribe(cs->conn, cs->conn->xprt_ctx, SUB_RETRY_RECV, &h1s->h1c->wait_event);
goto end; goto end;
} }
@ -2329,7 +2329,7 @@ static int h1_rcv_pipe(struct conn_stream *cs, struct pipe *pipe, unsigned int c
if (h1m->state == H1_MSG_DATA && count > h1m->curr_len) if (h1m->state == H1_MSG_DATA && count > h1m->curr_len)
count = h1m->curr_len; count = h1m->curr_len;
ret = cs->conn->xprt->rcv_pipe(cs->conn, cs->conn->xprt_ctx, pipe, count); ret = cs->conn->xprt->rcv_pipe(cs->conn, cs->conn->xprt_ctx, pipe, count);
if (h1m->state == H1_MSG_DATA && ret > 0) { if (h1m->state == H1_MSG_DATA && ret >= 0) {
h1m->curr_len -= ret; h1m->curr_len -= ret;
if (!h1m->curr_len) if (!h1m->curr_len)
h1s->flags &= ~(H1S_F_BUF_FLUSH|H1S_F_SPLICED_DATA); h1s->flags &= ~(H1S_F_BUF_FLUSH|H1S_F_SPLICED_DATA);