summaryrefslogtreecommitdiff
path: root/Assistant/Threads/Committer.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-09-17 21:32:30 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-09-17 22:04:43 -0400
commitadf5195082c9d70fc6b7f677417b0cc93a1a33eb (patch)
tree57a7a9eb7a1200bd21fcc941ec91144dd4c6819e /Assistant/Threads/Committer.hs
parent3c22977e44b852ecc4d1ad2d728e5dc9071952ae (diff)
run current branch merge in annex monad
I was seeing some interesting crashes after the previous commit, when making file changes slightly faster than the assistant could keep up. error: Ref refs/heads/master is at 7074f8e0a11110c532d06746e334f2fec6af6ab4 but expected 95ea86008d72a40d97a81cfc8fb47a0da92166bd fatal: cannot lock HEAD ref Committer crashed: git commit [Param "--allow-empty-message",Param "-m",Param "",Param "--allow-empty",Param "--quiet"] failed Pusher crashed: thread blocked indefinitely in an STM transaction Clearly the the merger ended up running at the same time as the committer, and with both modifying HEAD the committer crashed. I fixed that by making the Merger run its merge inside the annex monad, which avoids it running concurrently with other git operations. Also by making the committer not crash if git fails. What I don't understand is why the pusher then crashed with a STM deadlock. That must be in either the DaemonStatusHandle or the FailedPushMap, and the latter is only used by the pusher. Did the committer's crash somehow break STM? The BlockedIndefinitelyOnSTM exception is described as: -- |The thread is waiting to retry an STM transaction, but there are no -- other references to any @TVar@s involved, so it can't ever continue. If the Committer had a reference to a TVar and crashed, I can sort of see this leading to that exception.. The crash was quite easy to reproduce after the previous commit, but after making the above change, I have yet to see it again. Here's hoping.
Diffstat (limited to 'Assistant/Threads/Committer.hs')
-rw-r--r--Assistant/Threads/Committer.hs7
1 files changed, 3 insertions, 4 deletions
diff --git a/Assistant/Threads/Committer.hs b/Assistant/Threads/Committer.hs
index 43bb7b03d..809245325 100644
--- a/Assistant/Threads/Committer.hs
+++ b/Assistant/Threads/Committer.hs
@@ -55,8 +55,7 @@ commitThread st changechan commitchan transferqueue dstatus = thread $ runEvery
, "changes"
]
void $ alertWhile dstatus commitAlert $
- tryIO (runThreadState st commitStaged)
- >> return True
+ runThreadState st commitStaged
recordCommit commitchan (Commit time)
else refill readychanges
else refill changes
@@ -72,10 +71,10 @@ commitThread st changechan commitchan transferqueue dstatus = thread $ runEvery
refillChanges changechan cs
-commitStaged :: Annex ()
+commitStaged :: Annex Bool
commitStaged = do
Annex.Queue.flush
- inRepo $ Git.Command.run "commit"
+ inRepo $ Git.Command.runBool "commit"
[ Param "--allow-empty-message"
, Param "-m", Param ""
-- Empty commits may be made if tree changes cancel