]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stream/cli: report correct stream age in "show sess"
authorWilly Tarreau <w@1wt.eu>
Fri, 17 Nov 2023 17:51:26 +0000 (18:51 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 17 Nov 2023 17:59:12 +0000 (18:59 +0100)
Since 2.4-dev2 with commit 15e525f49 ("MINOR: stream: Don't retrieve
anymore timing info from the mux csinfo"), we don't replace the
tv_accept (now accept_ts) anymore with the current request's, so that
it properly reflects the session's accept date and not the request's
date. However, since then we failed to update "show sess" to make use
of the request's timestamp instead of the session's timestamp, resulting
in fantasist values in the "age" field of "show sess" for the task.

Indeed, the session's age is displayed instead of the stream's, which
leads to great confusion when debugging, particularly when it comes to
multiplexed inter-proxy connections which are kept up forever.

Let's fix this now. This must be backported as far as 2.4. However,
for 2.7 and older, the field was named tv_request and was a timeval.

src/stream.c

index 497e1d83f54d3bc46061c30422a4e219155eb9d2..9b9c74c17bf90143a27a451903d20a13c7b9a925 100644 (file)
@@ -3255,7 +3255,7 @@ void strm_dump_to_buffer(struct buffer *buf, const struct stream *strm, const ch
 
        chunk_appendf(buf,
                     " age=%s)\n",
-                    human_time(ns_to_sec(now_ns) - ns_to_sec(strm->logs.accept_ts), 1));
+                    human_time(ns_to_sec(now_ns) - ns_to_sec(strm->logs.request_ts), 1));
 
        if (strm->txn)
                chunk_appendf(buf,
@@ -3648,7 +3648,7 @@ static int cli_io_handler_dump_sess(struct appctx *appctx)
                chunk_appendf(&trash,
                             " ts=%02x epoch=%#x age=%s calls=%u rate=%u cpu=%llu lat=%llu",
                             curr_strm->task->state, curr_strm->stream_epoch,
-                            human_time(ns_to_sec(now_ns) - ns_to_sec(curr_strm->logs.accept_ts), 1),
+                            human_time(ns_to_sec(now_ns) - ns_to_sec(curr_strm->logs.request_ts), 1),
                             curr_strm->task->calls, read_freq_ctr(&curr_strm->call_rate),
                             (unsigned long long)curr_strm->cpu_time, (unsigned long long)curr_strm->lat_time);