From 7a78d6c600a3ab4bd3847fee90f204d976cd360a Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 7 Aug 2026 15:06:53 +0200 Subject: [PATCH] BUG/MINOR: debug: only dump the trace once in __BUG_ON_ONCE() Amaury found that CHECK_IF() was dumping the stack trace on each call, which was not the intent. The reason is that complain() performs the check on the counter, but the decision to dump the stack later is based on the choice between aborting and dumping. Let's break out of this when the count is > 1. Under high concurrency it can cause a trace never to be emitted but this is a detail. The whole thing needs to be redone more cleanly anyway. This should be backported to 2.6. --- include/haproxy/bug.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/haproxy/bug.h b/include/haproxy/bug.h index bb1fc0147..2f4c77543 100644 --- a/include/haproxy/bug.h +++ b/include/haproxy/bug.h @@ -335,6 +335,8 @@ extern __attribute__((__weak__)) struct debug_count __stop_dbg_cnt HA_SECTION_S else \ msg = "\n" pfx "condition \"" #cond "\" matched at " file ":" #line "" sfx "\n"; \ complain(&__match_count_##line, msg, crash); \ + if (_HA_ATOMIC_LOAD(&__match_count_##line) > 1) \ + break; \ if (crash & 1) \ ABORT_NOW(); \ else \ -- 2.47.3