From 908d47305bc8aa7fb63725c3991dafe57e1da23d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 17 Jul 2020 01:46:59 +0200 Subject: [PATCH] fix race in runWorker --- sched.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sched.go b/sched.go index 44e62f6c2..caf67c678 100644 --- a/sched.go +++ b/sched.go @@ -367,7 +367,10 @@ func (sh *scheduler) trySched() { func (sh *scheduler) runWorker(wid WorkerID) { go func() { + sh.workersLk.Lock() worker := sh.workers[wid] + sh.workersLk.Unlock() + scheduledWindows := make(chan *schedWindow, SchedWindows) taskDone := make(chan struct{}, 1) windowsRequested := 0