BUG/MEDIUM: mux-h2: do not quit the demux loop before setting END_REACHED
authorWilly Tarreau <w@1wt.eu>
Fri, 5 Feb 2021 11:16:01 +0000 (12:16 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 5 Feb 2021 14:32:29 +0000 (15:32 +0100)
The demux loop could quit on missing data but the H2_CF_END_REACHED flag
would not be set in this case. This fixes a remaining situation where
previous commit f09612289 ("BUG/MEDIUM: mux-h2: handle remaining read0
cases") could not be sufficient and still leave CLOSE_WAIT. It's harder
to reproduce but was still observed in prod.

Now we quit via the end of the loop which already takes care of shutr.

This should be backported along with the patch above as far as 2.0.

(cherry picked from commit 133aaa9f110f5b78e57a23f9db0553e2978eca0e)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 02bd15b8db6990fd518544aa1a182afa5eaf7a2d)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit a89aea1a1638591dab4aca8d1c2c71571957c74c)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>

src/mux_h2.c

index 1b60607..23f3671 100644 (file)
@@ -2973,7 +2973,7 @@ static void h2_process_demux(struct h2c *h2c)
 
                if (!b_data(&h2c->dbuf)) {
                        TRACE_DEVEL("no more Rx data", H2_EV_RX_FRAME, h2c->conn);
-                       break;
+                       goto dbuf_empty;
                }
 
                if (h2c->st0 >= H2_CS_ERROR) {
@@ -3204,6 +3204,7 @@ static void h2_process_demux(struct h2c *h2c)
                        ret = h2c_send_rst_stream(h2c, h2s);
                }
 
+       dbuf_empty:
                /* error or missing data condition met above ? */
                if (ret <= 0) {
                        TRACE_DEVEL("insufficient data to proceed", H2_EV_RX_FRAME, h2c->conn, h2s);