Hello, (v2: no code change. After re-reading the commit message a few times I realised it was missing the key detail that this only bites once a health check has failed and recovered, so the wording now spells that out.)
I ran into a situation where a backend server got stuck in "DOWN (agent)"
and wouldn't come back. It turned out agent.health is left at 0 when the
agent-check is declared directly on the server line and the backend has no
default-server: srv_settings_init() sets agent.rise but not agent.health,
and that path became reachable for regular servers once defsrv was made
optional in 3.3.
The server starts up fine - the wrong agent.health goes unnoticed while it
stays up. But the moment the regular health check fails and then recovers,
agent.health is still 0 (below rise) and the server can't be brought back
up. In my case the agent never reports the server up (it just closes the
connection), which is the only thing that would raise agent.health, so it
stays stuck for good.
This backend is broken (server stuck DOWN (agent) after a check failure,
never recovers):
backend be
option httpchk
http-check expect status 200
server s1 127.0.0.1:8080 check agent-check agent-send foo \
agent-addr 127.0.0.1 agent-port 3333 agent-inter 2s
while the exact same settings moved to a default-server line work fine:
backend be
option httpchk
http-check expect status 200
default-server check agent-check agent-addr 127.0.0.1 \
agent-port 3333 agent-inter 2s
server s1 127.0.0.1:8080 agent-send foo
Both forms behaved identically (and correctly) in 3.2 and earlier.
The one-liner attached fixes it. I reproduced it on 3.3, 3.4 and current
master, and the same patch applies to all three.
Cheers,
Steven
v2-0001-BUG-MEDIUM-server-initialise-agent.health-in-srv_.patch
Description: Binary data

