]> git.kaiwu.me - haproxy.git/commitdiff
CLEANUP: mux-h2: fix minor output debugging format issues
authorWilly Tarreau <w@1wt.eu>
Mon, 11 May 2026 12:49:36 +0000 (14:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 11 May 2026 14:04:19 +0000 (16:04 +0200)
In h2_dump_h2s_info(), the tl.calls was being printed as signed instead
of unsigned, which is not correct but harmless (only used with "show
fd"). In the same function, we don't check if h2s->sd is valid while
dereferencing it. In practise it is valid since "show fd" is run under
thread isolation, but it's far from being obvious, and if conditions
would later change, we don't know it could be printed between h2s_new()
and h2s_frt_stream_new(). Finally in h2s_make_data() a wrong set of
H2_EV_RX_* flags were used instead of H2_EV_TX_* to emit traces.

src/mux_h2.c

index 2000104d2d8eab7cfd7c9fcd4c29c7fbc1747858..00eb1eebee542964dd2bd968b35621f7bedfce2b 100644 (file)
@@ -7340,7 +7340,7 @@ static size_t h2s_make_data(struct h2s *h2s, struct buffer *buf, size_t count)
                        h2s->flags |= H2_SF_BLK_MBUSY;
                }
                else {
-                       TRACE_ERROR("Request DATA frame for aborted tunnel", H2_EV_RX_FRAME|H2_EV_RX_DATA, h2c->conn, h2s);
+                       TRACE_ERROR("Request DATA frame for aborted tunnel", H2_EV_TX_FRAME|H2_EV_TX_DATA, h2c->conn, h2s);
                        h2s_error(h2s, H2_ERR_CANCEL);
                }
                goto end;
@@ -8499,7 +8499,8 @@ static int h2_dump_h2s_info(struct buffer *msg, const struct h2s *h2s, const cha
                              h2s_sc(h2s)->flags, h2s_sc(h2s)->app);
 
        chunk_appendf(msg, " .sd=%p", h2s->sd);
-       chunk_appendf(msg, "(.flg=0x%08x .evts=%s)", se_fl_get(h2s->sd), tevt_evts2str(h2s->sd->term_evts_log));
+       if (h2s->sd)
+               chunk_appendf(msg, "(.flg=0x%08x .evts=%s)", se_fl_get(h2s->sd), tevt_evts2str(h2s->sd->term_evts_log));
 
        if (pfx)
                chunk_appendf(msg, "\n%s", pfx);
@@ -8507,7 +8508,7 @@ static int h2_dump_h2s_info(struct buffer *msg, const struct h2s *h2s, const cha
        chunk_appendf(msg, " .subs=%p", h2s->subs);
        if (h2s->subs) {
                chunk_appendf(msg, "(ev=%d tl=%p", h2s->subs->events, h2s->subs->tasklet);
-               chunk_appendf(msg, " tl.calls=%d tl.ctx=%p tl.fct=",
+               chunk_appendf(msg, " tl.calls=%u tl.ctx=%p tl.fct=",
                              h2s->subs->tasklet->calls,
                              h2s->subs->tasklet->context);
                if (h2s->subs->tasklet->calls >= 1000000)