From 0d5123633d8a9da1670b7b348d4c5def133d9d45 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 11 Sep 2014 13:53:26 -0400 Subject: Fix transfer lock file FD leak that could occur when two separate git-annex processes were both working to perform the same set of transfers. --- Annex/Transfer.hs | 4 +++- debian/changelog | 3 +++ doc/bugs/too_many_open_files_on_OSX.mdwn | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Annex/Transfer.hs b/Annex/Transfer.hs index 448b5b3d7..d33d3073b 100644 --- a/Annex/Transfer.hs +++ b/Annex/Transfer.hs @@ -85,7 +85,9 @@ runTransfer' ignorelock t file shouldretry a = do locked <- catchMaybeIO $ setLock fd (WriteLock, AbsoluteSeek, 0, 0) if isNothing locked - then return (Nothing, True) + then do + closeFd fd + return (Nothing, True) else do void $ tryIO $ writeTransferInfoFile info tfile return (mfd, False) diff --git a/debian/changelog b/debian/changelog index 0e267eb0a..22eaf0bae 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,9 @@ git-annex (5.20140832) UNRELEASED; urgency=medium if a key is present on a rsync remote, and when dropping a key from the remote. * Promote file not found warning message to an error. + * Fix transfer lock file FD leak that could occur when two separate + git-annex processes were both working to perform the same set of + transfers. -- Joey Hess Thu, 04 Sep 2014 16:17:22 -0400 diff --git a/doc/bugs/too_many_open_files_on_OSX.mdwn b/doc/bugs/too_many_open_files_on_OSX.mdwn index d30870a3b..2ca89fcf0 100644 --- a/doc/bugs/too_many_open_files_on_OSX.mdwn +++ b/doc/bugs/too_many_open_files_on_OSX.mdwn @@ -36,3 +36,7 @@ lsof -p .../.git/annex/ssh/myserver.lock .../.git/annex/transfer/upload/b4d67c4f-8cca-423c-9363-f3063b7fe3e4/lck.SHA256E-s10448418--4f61fab4... ~200 different files. """]] + +> Thanks for a very clear bug report! Was easy from that to find +> where the lock file was not being closed in this situation. +> [[fixed|done]] --[[Joey]] -- cgit v1.2.3