]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-h1: Increment open_streams counter when H1 stream is created
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 12 Sep 2022 05:46:11 +0000 (07:46 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 12 Sep 2022 07:54:11 +0000 (09:54 +0200)
Since this counter was added, it was incremented at the wrong place for
client streams. It was incremented when the stream-connector (formely the
conn-stream) was created while it should be done when the H1 stream is
created. Thus, on parsing error, on H1>H2 upgrades or TCP>H1 upgrades, the
counter is not incremented. However, it is always decremented when the H1
stream is destroyed.

On bakcned side, there is no issue.

This patch must be backported to 2.6.

src/mux_h1.c

index 441ae3ee4d3441b629bdb656ba8c9c32edbfbce0..02ac4bbaa2806a5473a2d0e5979fc1c770551787 100644 (file)
@@ -737,9 +737,6 @@ static struct stconn *h1s_new_sc(struct h1s *h1s, struct buffer *input)
                goto err;
        }
 
-       HA_ATOMIC_INC(&h1c->px_counters->open_streams);
-       HA_ATOMIC_INC(&h1c->px_counters->total_streams);
-
        h1c->flags = (h1c->flags & ~H1C_F_ST_EMBRYONIC) | H1C_F_ST_ATTACHED | H1C_F_ST_READY;
        TRACE_LEAVE(H1_EV_STRM_NEW, h1c->conn, h1s);
        return h1s_sc(h1s);
@@ -837,6 +834,9 @@ static struct h1s *h1c_frt_stream_new(struct h1c *h1c, struct stconn *sc, struct
        if (h1c->px->options2 & PR_O2_REQBUG_OK)
                h1s->req.err_pos = -1;
 
+       HA_ATOMIC_INC(&h1c->px_counters->open_streams);
+       HA_ATOMIC_INC(&h1c->px_counters->total_streams);
+
        h1c->idle_exp = TICK_ETERNITY;
        h1_set_idle_expiration(h1c);
        TRACE_LEAVE(H1_EV_H1S_NEW, h1c->conn, h1s);