MEDIUM: config: validate that peers sections are bound to exactly one process

If a peers section is bound to no process, it's silently discarded. If its
bound to multiple processes, an error is emitted and the process will not
start.
This commit is contained in:
Willy Tarreau 2015-05-01 19:15:17 +02:00
parent f83d3fe00a
commit 1e27301866

View File

@ -7907,9 +7907,9 @@ out_uri_auth_compat:
struct peers *curpeers = peers, **last;
struct peer *p, *pb;
/* Remove all peers sections which don't have a valid listener.
* This can happen when a peers section is never referenced and
* does not contain a local peer.
/* Remove all peers sections which don't have a valid listener,
* which are not used by any table, or which are bound to more
* than one process.
*/
last = &peers;
while (*last) {
@ -7925,6 +7925,18 @@ out_uri_auth_compat:
Warning("Removing incomplete section 'peers %s' (no peer named '%s').\n",
curpeers->id, localpeer);
}
else if (popcount(curpeers->peers_fe->bind_proc) != 1) {
/* either it's totally stopped or too much used */
if (curpeers->peers_fe->bind_proc) {
Alert("Peers section '%s': peers referenced by sections "
"running in different processes. Check global.nbproc"
" and all tables' bind_proc settings.\n",
curpeers->id);
cfgerr++;
}
stop_proxy(curpeers->peers_fe);
curpeers->peers_fe = NULL;
}
else {
last = &curpeers->next;
continue;