MEDIUM: config: warn on unitless timeouts < 100 ms
authorWilly Tarreau <w@1wt.eu>
Mon, 18 Nov 2024 18:47:59 +0000 (19:47 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 19 Nov 2024 09:33:20 +0000 (10:33 +0100)
commit9c6ccb8dbb242aec2844d9eff2d5e73c96756e73
treece3f3ecaf5584d693cd5b4c49e609a55b91238bb
parent9d511b3c2719e0b71746ff7e036583cc39b99a8b
MEDIUM: config: warn on unitless timeouts < 100 ms

From time to time we face a configuration with very small timeouts which
look accidental because there could be expectations that they're expressed
in seconds and not milliseconds.

This commit adds a check for non-nul unitless values smaller than 100
and emits a warning suggesting to append an explicit unit if that was
the intent.

Only the common timeouts, the server check intervals and the resolvers
hold and timeout values were covered for now. All the code needs to be
manually reviewed to verify if it supports emitting warnings.

This may break some configs using "zero-warning", but greps in existing
configs indicate that these are extremely rare and solely intentionally
done during tests. At least even if a user leaves that after a test, it
will be more obvious when reading 10ms that something's probably not
correct.
include/haproxy/tools.h
src/check.c
src/proxy.c
src/resolvers.c