]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mux-h2: make sure to always notify streams of EOS condition
authorWilly Tarreau <w@1wt.eu>
Mon, 25 Mar 2019 17:13:16 +0000 (18:13 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 Mar 2019 17:13:16 +0000 (18:13 +0100)
Recent commit 63768a63d ("MEDIUM: mux-h2: Don't mix the end of the message
with the end of stream") introduced a race which may manifest itself with
small connection counts on large objects and large server timeouts in
legacy mode. Sometimes h2s_close() is called while the data layer is
subscribed to read events but nothing in the chain can cause this wake-up
to happen and some streams stall for a while at the end of a transfer
until the server timeout strikes and ends the stream completes.

We need to wake the stream up if it's subscribed to rx events there,
which is what this patch does. When the patch above is backported to
1.9, this patch will also have to be backported.

src/mux_h2.c

index b6c2c809347a98569a80d05c50243c4a4e2d5117..9894592e58a02b24776146bd610e45ff937863d4 100644 (file)
@@ -840,8 +840,11 @@ static inline void h2s_close(struct h2s *h2s)
                h2s->h2c->nb_streams--;
                if (!h2s->id)
                        h2s->h2c->nb_reserved--;
-               if (h2s->cs)
+               if (h2s->cs) {
                        h2s->cs->flags |= CS_FL_REOS;
+                       if (!(h2s->cs->flags & CS_FL_EOS) && !b_data(&h2s->rxbuf))
+                               h2s_notify_recv(h2s);
+               }
        }
        h2s->st = H2_SS_CLOSED;
 }