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 )
This commit is contained in:
Emeric Brun 2021-04-21 16:06:35 +02:00 committed by Willy Tarreau
parent 8a022d5049
commit 2c4ab41816
1 changed files with 9 additions and 0 deletions

View File

@ -2896,6 +2896,15 @@ struct task *process_peer_sync(struct task * task, void *context, unsigned int s
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)) {