From d066526495f92d770b2aca73dc4fe30358afd7ea Mon Sep 17 00:00:00 2001 From: Sai Prasad Date: Tue, 18 Aug 2020 07:05:34 +0530 Subject: [PATCH] Fix a deadlock scenario in envfiles usage --- agent/taskresource/envFiles/envfile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/taskresource/envFiles/envfile.go b/agent/taskresource/envFiles/envfile.go index 314af51f33c..8905c956af6 100644 --- a/agent/taskresource/envFiles/envfile.go +++ b/agent/taskresource/envFiles/envfile.go @@ -108,13 +108,13 @@ func (envfile *EnvironmentFileResource) Initialize(resourceFields *taskresource. taskKnownStatus status.TaskStatus, taskDesiredStatus status.TaskStatus) { envfile.lock.Lock() - defer envfile.lock.Unlock() envfile.initStatusToTransition() envfile.credentialsManager = resourceFields.CredentialsManager envfile.s3ClientCreator = factory.NewS3ClientCreator() envfile.ioutil = ioutilwrapper.NewIOUtil() envfile.bufio = bufiowrapper.NewBufio() + envfile.lock.Unlock() // if task isn't in 'created' status and desired status is 'running', // reset the resource status to 'NONE' so we always retrieve the data