From: Willy Tarreau Date: Fri, 17 Nov 2023 17:51:26 +0000 (+0100) Subject: BUG/MINOR: stream/cli: report correct stream age in "show sess" X-Git-Tag: v2.9-dev10~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec76e0138b418ccb57da45f00e97f4cf2dcc2582;p=thirdparty%2Fhaproxy.git BUG/MINOR: stream/cli: report correct stream age in "show sess" 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. --- diff --git a/src/stream.c b/src/stream.c index 497e1d83f5..9b9c74c17b 100644 --- a/src/stream.c +++ b/src/stream.c @@ -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);