Merge pull request #3028 from filecoin-project/feat/fix-sched-deadlock

sealing sched: Fix deadlock in worker watcher
This commit is contained in:
Łukasz Magiera 2020-08-13 13:46:07 +02:00 committed by GitHub
commit ccfb33c294
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,11 +87,14 @@ func (sh *scheduler) runWorkerWatcher() {
} }
log.Warnf("worker %d dropped", wid) log.Warnf("worker %d dropped", wid)
select { // send in a goroutine to avoid a deadlock between workerClosing / watchClosing
case sh.workerClosing <- wid: go func() {
case <-sh.closing: select {
return case sh.workerClosing <- wid:
} case <-sh.closing:
return
}
}()
} }
} }
} }