committer: Fix a file handle leak.

This commit is contained in:
Joey Hess 2013-01-05 13:42:31 -04:00
parent 8f3d07b565
commit bf1981f60e
3 changed files with 9 additions and 1 deletions

View file

@ -60,7 +60,8 @@ lockDown file = do
tmp <- fromRepo gitAnnexTmpDir
createAnnexDirectory tmp
liftIO $ do
(tmpfile, _handle) <- openTempFile tmp (takeFileName file)
(tmpfile, handle) <- openTempFile tmp (takeFileName file)
hClose handle
nukeFile tmpfile
createLink file tmpfile
return $ KeySource { keyFilename = file , contentLocation = tmpfile }

1
debian/changelog vendored
View file

@ -1,6 +1,7 @@
git-annex (3.20130103) UNRELEASED; urgency=low
* webapp: Add UI to stop and restart assistant.
* committer: Fix a file handle leak.
-- Joey Hess <joeyh@debian.org> Thu, 03 Jan 2013 14:58:45 -0400

View file

@ -24,3 +24,9 @@ What version of git-annex are you using? On what operating system?
Please provide any additional information below.
I imagine I could avoid this error by using the "ulimit -n" command to increase number of files in a shell session and then running assistant manually, so this is really only a bug report about the bundled application.
> This seems to be caused by Command.Add.lockdown not closing the
> temporary file handle, so when called in a mapM by the committer
> thread when there are a lot of files, it could build up a lot of
> open handles before later GC closes them. Added a manual close,
> so I think this is [[done]]. --[[Joey]]