summaryrefslogtreecommitdiff
path: root/Annex/Action.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-09-29 22:36:08 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-09-29 22:36:08 -0400
commitc85e2d09160e46d9bf38b711308708c8d13119d6 (patch)
tree8e22990c20f3551e87d96e15a0b5b05c6586cf38 /Annex/Action.hs
parentb8248cf826a69ca43d3fe462b6686407cb859c65 (diff)
fix process and FD leak
Fix process and file descriptor leak that was exposed when git-annex was built with ghc 8.2.1. Apparently ghc has changed its behavior of GC of open file handles that are pipes to running processes. That broke git-annex test on OSX due to running out of FDs. Audited for all uses of Annex.new and made stopCoProcesses be called once it's done with the state. Fixed several places that might have leaked in other situations than running the test suite. This commit was sponsored by Ewen McNeill.
Diffstat (limited to 'Annex/Action.hs')
-rw-r--r--Annex/Action.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/Annex/Action.hs b/Annex/Action.hs
index a18ebaf78..fc8be6c91 100644
--- a/Annex/Action.hs
+++ b/Annex/Action.hs
@@ -17,6 +17,10 @@ import System.Posix.Signals
import Annex.Common
import qualified Annex
import Annex.Content
+import Annex.CatFile
+import Annex.CheckAttr
+import Annex.HashObject
+import Annex.CheckIgnore
{- Actions to perform each time ran. -}
startup :: Annex ()
@@ -32,4 +36,13 @@ shutdown :: Bool -> Annex ()
shutdown nocommit = do
saveState nocommit
sequence_ =<< M.elems <$> Annex.getState Annex.cleanup
+ stopCoProcesses
liftIO reapZombies -- zombies from long-running git processes
+
+{- Stops all long-running git query processes. -}
+stopCoProcesses :: Annex ()
+stopCoProcesses = do
+ catFileStop
+ checkAttrStop
+ hashObjectStop
+ checkIgnoreStop