From: Emeric Brun Date: Wed, 21 Apr 2021 14:06:35 +0000 (+0200) Subject: BUG/MEDIUM: peers: initialize resync timer to get an initial full resync X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=e63385e6ee12d9db184d9cba7446f54db39ffd9f;p=haproxy-2.1.git BUG/MEDIUM: peers: initialize resync timer to get an initial full resync If a reload is performed and there is no incoming connections from the old process to push a full resync, the new process can be stuck waiting indefinitely for this conn and it never tries a fallback requesting a full resync from a remote peer because the resync timer was init to TICK_ETERNITY. This patch forces a reset of the resync timer to default value (5 secs) if we detect value is TICK_ETERNITY. This patch should be backported on all supported branches ( >= 1.6 ) (cherry picked from commit 2c4ab4181601b1956095eb9b2c9d99984828ccf9) Signed-off-by: Christopher Faulet (cherry picked from commit 13eca443b4b38c15cd5ec990a4f22dcd6c606a1e) Signed-off-by: Christopher Faulet (cherry picked from commit e2336e5d524d624f13e80309614d316aeac58df2) Signed-off-by: Christopher Faulet --- diff --git a/src/peers.c b/src/peers.c index cae60d5..90d7e4b 100644 --- a/src/peers.c +++ b/src/peers.c @@ -2627,6 +2627,15 @@ static struct task *process_peer_sync(struct task * task, void *context, unsigne if (!stopping) { /* Normal case (not soft stop)*/ + /* resync timeout set to TICK_ETERNITY means we just start + * a new process and timer was not initialized. + * We must arm this timer to switch to a request to a remote + * node if incoming connection from old local process never + * comes. + */ + if (peers->resync_timeout == TICK_ETERNITY) + peers->resync_timeout = tick_add(now_ms, MS_TO_TICKS(PEER_RESYNC_TIMEOUT)); + if (((peers->flags & PEERS_RESYNC_STATEMASK) == PEERS_RESYNC_FROMLOCAL) && (!nb_oldpids || tick_is_expired(peers->resync_timeout, now_ms)) && !(peers->flags & PEERS_F_RESYNC_ASSIGN)) {