have setConcurrency stop any running git coprocesses
When non-concurrent git coprocesses have been started, setConcurrency used to not stop them, and so could leak processes when enabling concurrency, eg when forkState is called. I do not think that ever actually happened, given where setConcurrency is called. And it probably would only leak one of each process, since it never downgrades from concurrent to non-concurrent.
This commit is contained in:
parent
261947683b
commit
15d617f7e1
3 changed files with 39 additions and 12 deletions
|
@ -17,6 +17,7 @@ import qualified Annex.Queue
|
||||||
import Annex.Action
|
import Annex.Action
|
||||||
import Types.Concurrency
|
import Types.Concurrency
|
||||||
import Types.CatFileHandles
|
import Types.CatFileHandles
|
||||||
|
import Annex.CatFile
|
||||||
import Annex.CheckAttr
|
import Annex.CheckAttr
|
||||||
import Annex.CheckIgnore
|
import Annex.CheckIgnore
|
||||||
|
|
||||||
|
@ -32,18 +33,31 @@ setConcurrency' NonConcurrent f =
|
||||||
{ Annex.concurrency = f NonConcurrent
|
{ Annex.concurrency = f NonConcurrent
|
||||||
}
|
}
|
||||||
setConcurrency' c f = do
|
setConcurrency' c f = do
|
||||||
cfh <- getState Annex.catfilehandles
|
oldc <- Annex.getState Annex.concurrency
|
||||||
cfh' <- case cfh of
|
case oldc of
|
||||||
CatFileHandlesNonConcurrent _ -> liftIO catFileHandlesPool
|
ConcurrencyCmdLine NonConcurrent -> fromnonconcurrent
|
||||||
CatFileHandlesPool _ -> pure cfh
|
ConcurrencyGitConfig NonConcurrent -> fromnonconcurrent
|
||||||
cah <- mkConcurrentCheckAttrHandle c
|
_
|
||||||
cih <- mkConcurrentCheckIgnoreHandle c
|
| oldc == newc -> return ()
|
||||||
Annex.changeState $ \s -> s
|
| otherwise ->
|
||||||
{ Annex.concurrency = f c
|
Annex.changeState $ \s -> s
|
||||||
, Annex.catfilehandles = cfh'
|
{ Annex.concurrency = newc
|
||||||
, Annex.checkattrhandle = Just cah
|
}
|
||||||
, Annex.checkignorehandle = Just cih
|
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
|
{- Allows forking off a thread that uses a copy of the current AnnexState
|
||||||
- to run an Annex action.
|
- to run an Annex action.
|
||||||
|
|
|
@ -22,3 +22,4 @@ parseConcurrency s = Concurrent <$> readish s
|
||||||
data ConcurrencySetting
|
data ConcurrencySetting
|
||||||
= ConcurrencyCmdLine Concurrency
|
= ConcurrencyCmdLine Concurrency
|
||||||
| ConcurrencyGitConfig Concurrency
|
| ConcurrencyGitConfig Concurrency
|
||||||
|
deriving (Eq)
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
[[!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.
|
||||||
|
"""]]
|
Loading…
Add table
Add a link
Reference in a new issue