allocator: Fix duplicated allocations that leak resources
allocator: Fix duplicated allocations that leak resources

The allocator listens to an event stream. When it sees a task update,
for example, and the task in that event is not allocated, it will
queue the task for allocation.

The problem is that that multiple update events like this may be
received before the event corresponding to the actual task allocation.
There could be two (or more) events in a row containing the unallocated
task, both of which could potentially cause the task to receive an IP
allocation.

This problem only happens if we receive stale events after we have
committed an allocation in the store. Fix it by always fetching the
latest version of the object from the store. Then it's not possible to
act on a stale version of a task, node, or service.

Signed-off-by: Aaron Lehmann <8ecfc6017a87905413dcd7d63696a2a4c351b604@docker.com>

dperny/swarmkit-1,elifa/swarmkit,AliyunContainerService/swarmkit,diogomonica/swarmkit,docker/swarmkit,fate-grand-order/swarmkit,alyyousuf7/swarmkit,cheyang/swarmkit,dperny/swarmkit-1,cheyang/swarmkit,RenaudWasTaken/swarmkit,Noyan759/swarmkit,diogomonica/swarmkit,elifa/swarmkit,allencloud/swarmkit,alyyousuf7/swarmkit,jlhawn/swarmkit,fate-grand-order/swarmkit,AliyunContainerService/swarmkit,docker/swarmkit,jlhawn/swarmkit,sungwonh/swarmkit,allencloud/swarmkit,RenaudWasTaken/swarmkit,Noyan759/swarmkit,sungwonh/swarmkit