From 9d5bd47634707963ac6be4fc90e64feded174d0a Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 21 Feb 2025 17:18:00 +0100 Subject: [PATCH] BUG/MINOR: stream: do not call co_data() from __strm_dump_to_buffer() co_data() was instrumented to detect cases where c->output > data and emits a warning if that's not correct. The problem is that it happens quite a bit during "show threads" if it interrupts traffic anywhere, and that in some environments building with -DDEBUG_STRICT_ACTION=3, it will kill the process. Let's just open-code the channel functions that make access to co_data(), there are not that many and the operations remain very simple. This can be backported to 3.1. It didn't trigger in earlier versions because they didn't have this CHECK_IF_HOT() test. --- src/stream.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/stream.c b/src/stream.c index f673c4f4f..1a8e4ee1b 100644 --- a/src/stream.c +++ b/src/stream.c @@ -3561,8 +3561,9 @@ static void __strm_dump_to_buffer(struct buffer *buf, const struct show_sess_ctx human_time(TICKS_TO_MS(strm->req.analyse_exp - now_ms), TICKS_TO_MS(1000)) : "", &strm->req.buf, - b_orig(&strm->req.buf), (unsigned int)co_data(&strm->req), - (unsigned int)ci_head_ofs(&strm->req), (unsigned int)ci_data(&strm->req), + b_orig(&strm->req.buf), (unsigned int)strm->req.output, + (unsigned int)b_peek_ofs(&strm->req.buf, strm->req.output), + (unsigned int)(c_data(&strm->req) - strm->req.output), (unsigned int)strm->req.buf.size); if (IS_HTX_STRM(strm)) { @@ -3593,8 +3594,9 @@ static void __strm_dump_to_buffer(struct buffer *buf, const struct show_sess_ctx human_time(TICKS_TO_MS(strm->res.analyse_exp - now_ms), TICKS_TO_MS(1000)) : "", &strm->res.buf, - b_orig(&strm->res.buf), (unsigned int)co_data(&strm->res), - (unsigned int)ci_head_ofs(&strm->res), (unsigned int)ci_data(&strm->res), + b_orig(&strm->res.buf), (unsigned int)strm->res.output, + (unsigned int)b_peek_ofs(&strm->res.buf, strm->res.output), + (unsigned int)(c_data(&strm->res) - strm->res.output), (unsigned int)strm->res.buf.size); if (IS_HTX_STRM(strm)) {