]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: Wrong peer task expiration handling during synchronization processing.
authorFrédéric Lécaille <flecaille@haproxy.com>
Mon, 29 May 2017 11:47:16 +0000 (13:47 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 21 Jun 2017 09:19:50 +0000 (11:19 +0200)
When a peer task has sent a synchronization request to remote peers
its next expiration date was updated based on a resynchronization timeout
value which itself may have already expired leading the underlying
poller to wait for 0ms during a fraction of second (consuming high CPU
resources).

With this patch we update such peer task expiration dates only if
the resynchronization timeout is not already expired.

Thanks to Patrick Hemmer who reported an issue with nice traces
which helped in finding this one.

This patch may be backported to 1.7 and 1.6.

src/peers.c

index beeec96f55ffab0d3d5040c496b76d0b57e6905d..7f63aa9fc7d65396ad6024bbc3183314d0275393 100644 (file)
@@ -1963,8 +1963,9 @@ static struct task *process_peer_sync(struct task * task)
 
                if ((peers->flags & PEERS_RESYNC_STATEMASK) != PEERS_RESYNC_FINISHED) {
                        /* Resync not finished*/
-                       /* reschedule task to resync timeout, to ended resync if needed */
-                       task->expire = tick_first(task->expire, peers->resync_timeout);
+                       /* reschedule task to resync timeout if not expired, to ended resync if needed */
+                       if (!tick_is_expired(peers->resync_timeout, now_ms))
+                               task->expire = tick_first(task->expire, peers->resync_timeout);
                }
        } /* !stopping */
        else {