import Annex.Action
import Types.Concurrency
import Types.CatFileHandles
+import Annex.CatFile
import Annex.CheckAttr
import Annex.CheckIgnore
{ Annex.concurrency = f NonConcurrent
}
setConcurrency' c f = do
- cfh <- getState Annex.catfilehandles
- cfh' <- case cfh of
- CatFileHandlesNonConcurrent _ -> liftIO catFileHandlesPool
- CatFileHandlesPool _ -> pure cfh
- cah <- mkConcurrentCheckAttrHandle c
- cih <- mkConcurrentCheckIgnoreHandle c
- Annex.changeState $ \s -> s
- { Annex.concurrency = f c
- , Annex.catfilehandles = cfh'
- , Annex.checkattrhandle = Just cah
- , Annex.checkignorehandle = Just cih
- }
+ oldc <- Annex.getState Annex.concurrency
+ case oldc of
+ ConcurrencyCmdLine NonConcurrent -> fromnonconcurrent
+ ConcurrencyGitConfig NonConcurrent -> fromnonconcurrent
+ _
+ | oldc == newc -> return ()
+ | otherwise ->
+ Annex.changeState $ \s -> s
+ { Annex.concurrency = newc
+ }
+ where
+ newc = f c
+ fromnonconcurrent = do
+ catFileStop
+ checkAttrStop
+ checkIgnoreStop
+ cfh <- liftIO catFileHandlesPool
+ cah <- mkConcurrentCheckAttrHandle c
+ cih <- mkConcurrentCheckIgnoreHandle c
+ Annex.changeState $ \s -> s
+ { Annex.concurrency = newc
+ , Annex.catfilehandles = cfh
+ , Annex.checkattrhandle = Just cah
+ , Annex.checkignorehandle = Just cih
+ }
{- Allows forking off a thread that uses a copy of the current AnnexState
- to run an Annex action.
--- /dev/null
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 12"""
+ date="2021-11-19T15:37:43Z"
+ content="""
+I found a case where zombie git processes could be started in theory,
+but only when git-annex is run without -J. And only a few zombies I think.
+And I couldn't find a code path where it actually happened.
+So not the same as this bug. But it did involve setConcurrency, which
+the bisected commit also involves (via forkState), so at least shows
+how that could cause a such a problem in theory. Fixed that.
+"""]]