13497: Merge branch 'master' into 13497-controller
[arvados.git] / services / crunch-run / crunchrun.go
index 5996a7cd6b47e6df011f2f1459c6f374778614b8..098c53f8a6a587816703ad6997ceb51eec7f0232 100644 (file)
@@ -190,7 +190,7 @@ func (runner *ContainerRunner) stop(sig os.Signal) {
 var errorBlacklist = []string{
        "(?ms).*[Cc]annot connect to the Docker daemon.*",
        "(?ms).*oci runtime error.*starting container process.*container init.*mounting.*to rootfs.*no such file or directory.*",
-       "(?ms).*grpc: the connection is unavailable",
+       "(?ms).*grpc: the connection is unavailable.*",
 }
 var brokenNodeHook *string = flag.String("broken-node-hook", "", "Script to run if node is detected to be broken (for example, Docker daemon is not running)")
 
@@ -1122,9 +1122,7 @@ func (runner *ContainerRunner) WaitFinish() error {
        }
 
        containerdGone := make(chan error)
-       defer func() {
-               close(containerdGone)
-       }()
+       defer close(containerdGone)
        if runner.checkContainerd > 0 {
                go func() {
                        ticker := time.NewTicker(time.Duration(runner.checkContainerd))
@@ -1137,7 +1135,8 @@ func (runner *ContainerRunner) WaitFinish() error {
                                                return
                                        }
                                case <-containerdGone:
-                                       break
+                                       // Channel closed, quit goroutine
+                                       return
                                }
                        }
                }()