From 0cfea7d97890a5a976872ebe951f7471aac13306 Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Mon, 21 Oct 2019 08:54:11 -0400 Subject: [PATCH] client: don't retry fingerprinting on shutdown At shutdown, driver manager context expires and the fingerprinting channel closes. Thus it is undeterministic which clause of The select statement gets executed, and we may keep retrying until the `i.ctx.Done()` block is executed. Here, we check always check ctx expiration before retrying again. --- client/pluginmanager/drivermanager/instance.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/pluginmanager/drivermanager/instance.go b/client/pluginmanager/drivermanager/instance.go index 5196ff8dd..d2074301d 100644 --- a/client/pluginmanager/drivermanager/instance.go +++ b/client/pluginmanager/drivermanager/instance.go @@ -307,6 +307,12 @@ func (i *instanceManager) fingerprint() { continue } + // avoid fingerprinting again if ctx and fpChan both close + if i.ctx.Err() != nil { + cancel() + return + } + // if the channel is closed attempt to open a new one newFpChan, newCancel, err := i.dispenseFingerprintCh() if err != nil {