diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-02-17 14:30:18 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-02-17 14:30:18 -0400 |
commit | f3affee1f111886057a5cc3083b55bfafa50bae8 (patch) | |
tree | 8b534056de91505376f7a45a0622f58d2e9d3e54 | |
parent | 615053c624b357520ef01db60c58e60d848a44bd (diff) |
have onLocal stop any coprocesses, not only cat-file
I have not seen any other coprocesses being started, but let's avoid
problems if any do for whatever reason.
-rw-r--r-- | Annex/Concurrent.hs | 16 | ||||
-rw-r--r-- | Remote/Git.hs | 6 |
2 files changed, 12 insertions, 10 deletions
diff --git a/Annex/Concurrent.hs b/Annex/Concurrent.hs index ee19d4766..71a70fa5b 100644 --- a/Annex/Concurrent.hs +++ b/Annex/Concurrent.hs @@ -56,14 +56,16 @@ dupState = do - Also closes various handles in it. -} mergeState :: AnnexState -> Annex () mergeState st = do - st' <- liftIO $ snd <$> run st closehandles + st' <- liftIO $ snd <$> run st stopCoProcesses forM_ (M.toList $ Annex.cleanup st') $ uncurry addCleanup Annex.Queue.mergeFrom st' changeState $ \s -> s { errcounter = errcounter s + errcounter st' } - where - closehandles = do - catFileStop - checkAttrStop - hashObjectStop - checkIgnoreStop + +{- Stops all long-running git query processes. -} +stopCoProcesses :: Annex () +stopCoProcesses = do + catFileStop + checkAttrStop + hashObjectStop + checkIgnoreStop diff --git a/Remote/Git.hs b/Remote/Git.hs index 604056fc2..0a49dd62a 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -54,9 +54,9 @@ import qualified Remote.P2P import P2P.Address import Annex.Path import Creds -import Annex.CatFile import Messages.Progress import Types.NumCopies +import Annex.Concurrent import Control.Concurrent import Control.Concurrent.MSampleVar @@ -613,7 +613,7 @@ repairRemote r a = return $ do {- Runs an action from the perspective of a local remote. - - The AnnexState is cached for speed and to avoid resource leaks. - - However, catFileStop is called to avoid git-cat-file processes hanging + - However, coprocesses are stopped to avoid git processes hanging - around on removable media. - - The repository's git-annex branch is not updated, as an optimisation. @@ -637,7 +637,7 @@ onLocal r a = do go st a' = do curro <- Annex.getState Annex.output (ret, st') <- liftIO $ Annex.run (st { Annex.output = curro }) $ - catFileStop `after` a' + stopCoProcesses `after` a' cache st' return ret |