As described in GH #3516, declaring a peers section containing the local
peer server (with server syntax) without the matching 'bind' diretive
causes haproxy to crash since
879c78c. However, as Amaury demonstrated,
the config is invalid/incomplete: it makes no sense to declare the local
peer server without the matching bind parameters. Before this patch
haproxy would let the config pass and the result was that the peers
proxy was created without any listeners. While it somehow didn't crash
in the past (perhaps the low level code was robust enough), from a
peers logic point of view it results in the peers proxy doing nothing.
Instead of silently failing (and now risking crashes upon reload), let's
proactively report a fatal error to the user that such config is
incomplete.
Many thanks to @alexandret-ik for the detailed report.
It should be backported to 3.4, and may be relevant to olders versions
but in this case replace the ha_alert() which ha_notice() so existing
configs that used to start (despite not valid from peers point of view)
don't break.
stop_proxy(curpeers->peers_fe);
curpeers->peers_fe = NULL;
}
+ else if (LIST_ISEMPTY(&curpeers->peers_fe->conf.listeners)) {
+ ha_alert("Incomplete section 'peers %s' (missing listen/bind information for local peer named '%s').\n",
+ curpeers->id, localpeer);
+ cfgerr++;
+ if (curpeers->peers_fe)
+ stop_proxy(curpeers->peers_fe);
+ curpeers->peers_fe = NULL;
+ }
else {
/* Initializes the transport layer of the server part of all the peers belonging to
* <curpeers> section if required.