BUG/MEDIUM: mux-h1: Wakeup the H1C in h1_rcv_buf() if more data are expected
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 24 Jul 2020 14:31:14 +0000 (16:31 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 24 Jul 2020 14:42:53 +0000 (16:42 +0200)
After the input processing, in h1_rcv_buf(), if more data are expected and the
H1C is not subscribed on receives, we now wake up the H1C to try to read more
data ASAP. This reverts commit a1dde23e. Depending on how data are received,
subscribing on receives at this stage may freeze the H1 connection because a
read event is missing.

This bug seems to no exist in the 2.2 because of changes on the connection
subscriptions. But we must be careful because I don't really know why the read
event is missed.

Moreover, the bug fixed by the commit a1dde23e will be fixed another way in
the next commit.

This patch should fix the issue #774. It must be backported to 2.0.

src/mux_h1.c

index d2f266a..0fe0475 100644 (file)
@@ -2646,7 +2646,7 @@ static size_t h1_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t coun
                        TRACE_STATE("disable splicing", H1_EV_STRM_RECV, h1c->conn, h1s);
                }
                if (h1m->state != H1_MSG_DONE && !(h1c->wait_event.events & SUB_RETRY_RECV))
-                       h1c->conn->xprt->subscribe(h1c->conn, h1c->conn->xprt_ctx, SUB_RETRY_RECV, &h1c->wait_event);
+                       tasklet_wakeup(h1c->wait_event.tasklet);
        }
        TRACE_LEAVE(H1_EV_STRM_RECV, h1c->conn, h1s,, (size_t[]){ret});
        return ret;