]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: debug: only emit and count warnings when explicitly requested
authorWilly Tarreau <w@1wt.eu>
Mon, 10 Aug 2026 15:01:13 +0000 (17:01 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 13 Aug 2026 15:43:30 +0000 (17:43 +0200)
Previously complain() would set TAINTED_WARN was set even for a
check_if() because there was no way to distinguish a warn from a check
and a warn was systematically accounted for when the type was not a
bug. Likewise, BUG_ON() would dump a trace whenever a non-fatal event
happened, which is not the goal either as it prevents from counting
events without logging them (e.g. COUNT_IF). Now that we have explicit
flags for each type, let's consider them when choosing what to emit.

Note that for now complain() will still log the "msg" line if used
without FATL nor WARN though.

include/haproxy/bug.h
src/debug.c

index d9cb907e8c0f3c0894e1fdc981ae046a6e34b238..6e29688713532686fc53911d9adc7b203a57199a 100644 (file)
@@ -417,7 +417,7 @@ extern __attribute__((__weak__)) struct debug_count __stop_dbg_cnt  HA_SECTION_S
                complain(NULL, msg, details);                           \
                if (details & DBG_DET_FAT_FATL)                         \
                        ABORT_NOW();                                    \
-               else                                                    \
+               else if (details & DBG_DET_FAT_WARN)                    \
                        ha_backtrace_to_stderr(0);                      \
        } while (0)
 
@@ -445,7 +445,7 @@ extern __attribute__((__weak__)) struct debug_count __stop_dbg_cnt  HA_SECTION_S
                complain(NULL, msg, details);                           \
                if (details & DBG_DET_FAT_FATL)                         \
                        ABORT_NOW();                                    \
-               else                                                    \
+               else if (details & DBG_DET_FAT_WARN)                    \
                        ha_backtrace_to_stderr(0);                      \
        } while (0)
 
index fa8b3c2c3c3278f47dedcf22fcd85ed64b1d44a5..84d48917caa9eeff25ba2f532b92c979bb5b5908 100644 (file)
@@ -977,7 +977,7 @@ void complain(int *counter, const char *msg, uint details)
        DISGUISE(write(2, msg, strlen(msg)));
        if (details & (DBG_DET_TYP_BUG|DBG_DET_TYP_ABT))
                mark_tainted(TAINTED_BUG);
-       else
+       else if (details & DBG_DET_TYP_WRN)
                mark_tainted(TAINTED_WARN);
 }