xen-org/xen-api — pull request #1161 by johnelse (2013-04-18 12:20:48+00:00)
Title: CA-103748: Swap heartbeat and delay in heartbeat thread

If a pool.hello takes over five minutes (which it can do if a lot of
slaves in a large pool are rebooted at once) the master's GC thread will
have declared the slave dead again by the time the pool.hello returns.

The heartbeat thread will signal to the master that the slave is in fact
still alive but only after waiting for the heartbeat delay (which by
default is 30 seconds long).

This means that there is a 30 second window where the startup sequence
is continuing but the slave is seen as dead on the master, and if the
slave tries to plug its PBDs in this window it will receive a
HOST_OFFLINE exception (i.e. the master is telling the slave that it
thinks the slave is offline).

This change means that the first heartbeat is sent *before* the delay
period, closing this window to the time taken to make a few database
calls.