From 66ddf6293186719a5fac7204b8575f86fbd952c3 Mon Sep 17 00:00:00 2001 From: Jerome Gravel-Niquet Date: Tue, 10 Nov 2020 16:04:22 -0500 Subject: [PATCH] Don't ignore nil devices in plugin fingerprint Even if a plugin sends back an empty `[]*device.DeviceGroup`, it's transformed to `nil` during the RPC. Our custom device plugin is returning empty `FingerprintResponse.Devices` very often. Our temporary fix is to send a dummy `*DeviceGroup` if the slice is empty. This has the effect of never triggering the "first fingerprint" and therefore timing out after 50s. In turn, this made our node exceed its hearbeat grace period when restarting it, revoking all vault tokens for its allocations, causing a restart of all our allocations because the token couldn't be renewed. Removing the logic for `f.Devices == nil` does not appear to affect the functionality of the function. --- client/devicemanager/instance.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/client/devicemanager/instance.go b/client/devicemanager/instance.go index edeeb2e8eb7..4ab248260c0 100644 --- a/client/devicemanager/instance.go +++ b/client/devicemanager/instance.go @@ -413,11 +413,6 @@ func (i *instanceManager) handleFingerprintError() { // handleFingerprint stores the new devices and triggers the fingerprint output // channel. An error is returned if the passed devices don't pass validation. func (i *instanceManager) handleFingerprint(f *device.FingerprintResponse) error { - // If no devices are returned then there is nothing to do. - if f.Devices == nil { - return nil - } - // Validate the received devices var validationErr multierror.Error for i, d := range f.Devices {