From 9af82f2d68a9f34906034bd2c9a42b064f6093c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sun, 3 Oct 2021 17:09:43 +0200 Subject: [PATCH] sched: Fix taskDone chan deadlock --- extern/sector-storage/sched_worker.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extern/sector-storage/sched_worker.go b/extern/sector-storage/sched_worker.go index ad74e01ee..42bba2ee5 100644 --- a/extern/sector-storage/sched_worker.go +++ b/extern/sector-storage/sched_worker.go @@ -475,6 +475,7 @@ func (sw *schedWorker) startProcessingTask(req *workerRequest) error { case sw.taskDone <- struct{}{}: case <-sh.closing: log.Warnf("scheduler closed while sending response (prepare error: %+v)", err) + default: // there is a notification pending already } select { @@ -496,6 +497,7 @@ func (sw *schedWorker) startProcessingTask(req *workerRequest) error { select { case sw.taskDone <- struct{}{}: case <-sh.closing: + default: // there is a notification pending already } // Do the work! @@ -550,6 +552,7 @@ func (sw *schedWorker) startProcessingReadyTask(req *workerRequest) error { case sw.taskDone <- struct{}{}: case <-sh.closing: log.Warnf("scheduler closed while sending response (prepare error: %+v)", err) + default: // there is a notification pending already } w.lk.Unlock()