From: Steven Honson Date: Sat, 27 Jun 2026 12:27:30 +0000 (+1000) Subject: BUG/MEDIUM: server: initialise agent.health in srv_settings_init() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7aec1e6d9ab2ccc11ce3c66610a8117cda2be094;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: server: initialise agent.health in srv_settings_init() srv_settings_init() sets agent.rise but forgets agent.health, while srv_settings_cpy() sets both. check.health is fixed up later when the server's admin state is updated at startup, but nothing does the same for agent.health. This used to be harmless because servers were always set up through srv_settings_cpy(). But since 49a619aca ("MEDIUM: proxy: no longer allocate the default-server entry by default") the defsrv pointer is NULL when a proxy has no "default-server" line, and srv_settings_cpy() then falls back to srv_settings_init(). So a server whose agent-check is declared entirely on its "server" line ends up with agent.health == 0, which is below agent.rise. The wrong value only bites when the server has to come back up. While it stays up nobody notices agent.health is 0, but as soon as the regular health check fails and recovers, agent.health is still 0 (below rise) and check_notify_success() won't bring the server back up. The agent never sends an explicit "up", which is the only thing that raises agent.health, so the server stays down for good. Moving the agent settings to a "default-server" line works around it. Just initialise agent.health in srv_settings_init() like srv_settings_cpy() already does. This should be backported to 3.3 and 3.4. --- diff --git a/src/server.c b/src/server.c index 8de9094d5..fa7e2583c 100644 --- a/src/server.c +++ b/src/server.c @@ -2888,7 +2888,7 @@ void srv_settings_init(struct server *srv) srv->agent.inter = DEF_CHKINTR; srv->agent.fastinter = 0; srv->agent.downinter = 0; - srv->agent.rise = DEF_AGENT_RISETIME; + srv->agent.rise = srv->agent.health = DEF_AGENT_RISETIME; srv->agent.fall = DEF_AGENT_FALLTIME; srv->agent.port = 0;