From 1cf23b8adc1d9b680083b8f04f2ec9a199550462 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 5 Jan 2013 13:42:31 -0400 Subject: committer: Fix a file handle leak. --- Command/Add.hs | 3 ++- debian/changelog | 1 + ...40__OS_X_Lion__41___-___34__too_many_open_files__34___error.mdwn | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Command/Add.hs b/Command/Add.hs index 25548a973..7b2d5fd30 100644 --- a/Command/Add.hs +++ b/Command/Add.hs @@ -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 } diff --git a/debian/changelog b/debian/changelog index 8979d29df..f98d335b7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Thu, 03 Jan 2013 14:58:45 -0400 diff --git a/doc/bugs/assistant___40__OS_X_Lion__41___-___34__too_many_open_files__34___error.mdwn b/doc/bugs/assistant___40__OS_X_Lion__41___-___34__too_many_open_files__34___error.mdwn index ad8d18fcf..1b3879e63 100644 --- a/doc/bugs/assistant___40__OS_X_Lion__41___-___34__too_many_open_files__34___error.mdwn +++ b/doc/bugs/assistant___40__OS_X_Lion__41___-___34__too_many_open_files__34___error.mdwn @@ -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]] -- cgit v1.2.3