remove reapZombies
authorJoey Hess <joeyh@joeyh.name>
Fri, 25 Sep 2020 15:47:34 +0000 (11:47 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 25 Sep 2020 15:50:38 +0000 (11:50 -0400)
Believed to be no longer needed as I've squashed the last ones.

Note that, in Test.Framework, I can see no reason for the code to have
run it twice. It does not cause running processes to exit after all,
so any process that has leaked and is running and causing problems with
cleanup of the directory won't be helped by running it.

This commit was sponsored by Mark Reidenbach on Patreon.

Annex/Action.hs
Benchmark.hs
Test/Framework.hs

index b3ad1d9088c548d4bfa648a1f19a14bf4544075e..1902b0d89c96c4b318e1d454536e7cdc82a7bb98 100644 (file)
@@ -5,20 +5,13 @@
  - Licensed under the GNU AGPL version 3 or higher.
  -}
 
-{-# LANGUAGE CPP #-}
-
 module Annex.Action (
        startup,
        shutdown,
        stopCoProcesses,
-       reapZombies,
 ) where
 
 import qualified Data.Map as M
-#ifndef mingw32_HOST_OS
-import System.Posix.Process (getAnyProcessStatus)
-import Utility.Exception
-#endif
 
 import Annex.Common
 import qualified Annex
@@ -38,7 +31,6 @@ 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 ()
@@ -47,19 +39,3 @@ stopCoProcesses = do
        checkAttrStop
        hashObjectStop
        checkIgnoreStop
-
-{- Reaps any zombie processes that may be hanging around.
- -
- - Warning: Not thread safe. Anything that was expecting to wait
- - on a process and get back an exit status is going to be confused
- - if this reap gets there first. -}
-reapZombies :: IO ()
-#ifndef mingw32_HOST_OS
-reapZombies =
-       -- throws an exception when there are no child processes
-       catchDefaultIO Nothing (getAnyProcessStatus False True)
-               >>= maybe (return ()) (const reapZombies)
-
-#else
-reapZombies = return ()
-#endif
index c365f0530ed19142f357bf1a5e6c0d2c6608252d..4f191b501e59a1aac1a1a1d28aad73b2b39036e4 100644 (file)
@@ -15,7 +15,6 @@ import CmdLine
 import CmdLine.GitAnnex.Options
 import qualified Annex
 import qualified Annex.Branch
-import Annex.Action
 
 import qualified Options.Applicative as O
 
@@ -35,10 +34,6 @@ mkGenerator cmds userinput = do
                        -- The cmd is run for benchmarking without startup or
                        -- shutdown actions.
                        Annex.eval st $ performCommandAction cmd seek noop
-               -- Since the cmd will be run many times, some zombie
-               -- processes that normally only occur once per command
-               -- will build up; reap them.
-               reapZombies
   where
        -- Simplified versio of CmdLine.dispatch, without support for fuzzy
        -- matching or out-of-repo commands.
index 79737b5481d56203bb2a486b23e39cd4e7da4bd8..ce7f482d067b5659e7df6e00a8a65506f7ec50ac 100644 (file)
@@ -245,15 +245,13 @@ cleanup dir = whenM (doesDirectoryExist dir) $ do
 
 finalCleanup :: IO ()
 finalCleanup = whenM (doesDirectoryExist tmpdir) $ do
-       Annex.Action.reapZombies
        Command.Uninit.prepareRemoveAnnexDir' tmpdir
        catchIO (removeDirectoryForCleanup tmpdir) $ \e -> do
                print e
                putStrLn "sleeping 10 seconds and will retry directory cleanup"
                Utility.ThreadScheduler.threadDelaySeconds $
                        Utility.ThreadScheduler.Seconds 10
-               whenM (doesDirectoryExist tmpdir) $ do
-                       Annex.Action.reapZombies
+               whenM (doesDirectoryExist tmpdir) $
                        removeDirectoryForCleanup tmpdir
 
 checklink :: FilePath -> Assertion