From 827cbfd60abe637ace2e24bee80a0b4c11507602 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Wed, 2 Dec 2020 15:47:48 -0500 Subject: [PATCH] Fix deadlock on error. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- import.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/import.go b/import.go index f4e0cd0008..f9d3a1a0ba 100644 --- a/import.go +++ b/import.go @@ -452,6 +452,13 @@ func (cmd *importer) tileInputs(tilelib *tileLibrary, infiles []string) error { }() } tileJobs.Wait() + if len(errs) > 0 { + // Must not wait on encodeJobs in this case. If the + // tileJobs goroutines exited early, some funcs in + // todo haven't been called, so the corresponding + // encodeJobs will wait forever. + return <-errs + } encodeJobs.Wait() go close(errs) -- 2.30.2