From ecbd45631261495e7f44cb23f98c18c79553ebb7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 17 Jun 2019 12:51:44 -0400 Subject: [PATCH] fix restoring worker pool bug The bug might have led to a STM deadlock, if this case could ever actually fire. --- CmdLine/Action.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CmdLine/Action.hs b/CmdLine/Action.hs index 625e8c1cd6..be18af8f90 100644 --- a/CmdLine/Action.hs +++ b/CmdLine/Action.hs @@ -193,11 +193,12 @@ changeStageTo newstage = do liftIO $ atomically $ waitWorkerSlot' (== newstage) tv >>= \case Just idlest -> do pool <- takeTMVar tv + let restorepool = addWorkerPool (IdleWorker idlest newstage) pool let pool' = case removeThreadIdWorkerPool mytid pool of Just ((myaid, oldstage), p) -> addWorkerPool (IdleWorker idlest oldstage) $ addWorkerPool (ActiveWorker myaid newstage) p - Nothing -> pool + Nothing -> restorepool putTMVar tv pool' -- No worker pool is allocated, not running in concurrent -- mode.