]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h2/traces: add missing flags and proxy ID in traces
authorWilly Tarreau <w@1wt.eu>
Sat, 12 Oct 2024 15:45:51 +0000 (17:45 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 12 Oct 2024 15:45:51 +0000 (17:45 +0200)
H2 traces are unusable to detect bugs most of the time because they miss
the h2c and h2s flags, as well as the proxy, which makes it very hard to
figure if the info comes from the client or the server as soon as two
layers are stacked. This commit adds these precious information as well
as the h2s's rx and tx windows.

This could be backported to a few recent branches, but the rx window
calculation will have to be replaced with the static value there.

src/mux_h2.c

index 61f23a7ae0b620671af0150f7c440fb58afe3751..f63a16b20b4256bd888ec07637b242e1c17ef655 100644 (file)
@@ -568,7 +568,9 @@ static void h2_trace(enum trace_level level, uint64_t mask, const struct trace_s
                return;
 
        if (src->verbosity > H2_VERB_CLEAN) {
-               chunk_appendf(&trace_buf, " : h2c=%p(%c,%s)", h2c, conn_is_back(conn) ? 'B' : 'F', h2c_st_to_str(h2c->st0));
+               chunk_appendf(&trace_buf, " : h2c=%p(%c=%s,%s,%#x)",
+                             h2c, conn_is_back(conn) ? 'B' : 'F', h2c->proxy->id,
+                             h2c_st_to_str(h2c->st0), h2c->flags);
 
                if (mask & H2_EV_H2C_NEW) // inside h2_init, otherwise it's hard to match conn & h2c
                        conn_append_debug_info(&trace_buf, conn, " : ");
@@ -590,7 +592,10 @@ static void h2_trace(enum trace_level level, uint64_t mask, const struct trace_s
                        if (h2s == h2_idle_stream)
                                chunk_appendf(&trace_buf, " h2s=IDL");
                        else if (h2s != h2_closed_stream && h2s != h2_refused_stream && h2s != h2_error_stream)
-                               chunk_appendf(&trace_buf, " h2s=%p(%d,%s)", h2s, h2s->id, h2s_st_to_str(h2s->st));
+                               chunk_appendf(&trace_buf, " h2s=%p(%d,%s,%#x) .rxw=%u .txw=%d",
+                                             h2s, h2s->id, h2s_st_to_str(h2s->st), h2s->flags,
+                                             (uint)(h2s->next_max_ofs - h2s->curr_rx_ofs),
+                                             h2s->sws + h2c->miw);
                        else if (h2c->dsi > 0) // don't show that before sid is known
                                chunk_appendf(&trace_buf, " h2s=CLO");
                        if (h2s->id && h2s->errcode)