[ARVADOS] created: 1.3.0-322-gd3e1ff27e

Git user git at public.curoverse.com
Wed Feb 13 16:50:12 EST 2019


        at  d3e1ff27ec14bcb8a7037cc72f54a6816efe5916 (commit)


commit d3e1ff27ec14bcb8a7037cc72f54a6816efe5916
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Wed Feb 13 16:47:36 2019 -0500

    14828: Fix double-cancel of unsatisfiable container.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/lib/dispatchcloud/container/queue.go b/lib/dispatchcloud/container/queue.go
index 847fe9e27..297782c35 100644
--- a/lib/dispatchcloud/container/queue.go
+++ b/lib/dispatchcloud/container/queue.go
@@ -223,8 +223,25 @@ func (cq *Queue) addEnt(uuid string, ctr arvados.Container) {
 		// error: it wouldn't help to try again, or to leave
 		// it for a different dispatcher process to attempt.
 		errorString := err.Error()
-		cq.logger.WithField("ContainerUUID", ctr.UUID).Warn("cancel container with no suitable instance type")
+		logger := cq.logger.WithField("ContainerUUID", ctr.UUID)
+		logger.WithError(err).Warn("cancel container with no suitable instance type")
 		go func() {
+			if ctr.State == arvados.ContainerStateQueued {
+				// Can't set runtime error without
+				// locking first. If Lock() is
+				// successful, it will call addEnt()
+				// again itself, and we'll fall
+				// through to the
+				// setRuntimeError/Cancel code below.
+				err := cq.Lock(ctr.UUID)
+				if err != nil {
+					logger.WithError(err).Warn("lock failed")
+					// ...and try again on the
+					// next Update, if the problem
+					// still exists.
+				}
+				return
+			}
 			var err error
 			defer func() {
 				if err == nil {
@@ -239,14 +256,8 @@ func (cq *Queue) addEnt(uuid string, ctr arvados.Container) {
 				if latest.State == arvados.ContainerStateCancelled {
 					return
 				}
-				cq.logger.WithField("ContainerUUID", ctr.UUID).WithError(err).Warn("error while trying to cancel unsatisfiable container")
+				logger.WithError(err).Warn("error while trying to cancel unsatisfiable container")
 			}()
-			if ctr.State == arvados.ContainerStateQueued {
-				err = cq.Lock(ctr.UUID)
-				if err != nil {
-					return
-				}
-			}
 			err = cq.setRuntimeError(ctr.UUID, errorString)
 			if err != nil {
 				return

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list