From 632fd36205b4be59417bc152bcc0fc6f305c2b03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 13 Aug 2020 12:17:24 +0200 Subject: [PATCH] sealing sched: Fix deadlock in worker watcher --- extern/sector-storage/sched_watch.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/extern/sector-storage/sched_watch.go b/extern/sector-storage/sched_watch.go index d93cf1af3..2dd9875d7 100644 --- a/extern/sector-storage/sched_watch.go +++ b/extern/sector-storage/sched_watch.go @@ -87,11 +87,14 @@ func (sh *scheduler) runWorkerWatcher() { } log.Warnf("worker %d dropped", wid) - select { - case sh.workerClosing <- wid: - case <-sh.closing: - return - } + // send in a goroutine to avoid a deadlock between workerClosing / watchClosing + go func() { + select { + case sh.workerClosing <- wid: + case <-sh.closing: + return + } + }() } } }