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.

This commit is contained in:
Joey Hess 2014-09-11 13:53:26 -04:00
parent c489dff1a7
commit 0598412e5c
3 changed files with 10 additions and 1 deletions

View file

@ -85,7 +85,9 @@ runTransfer' ignorelock t file shouldretry a = do
locked <- catchMaybeIO $ locked <- catchMaybeIO $
setLock fd (WriteLock, AbsoluteSeek, 0, 0) setLock fd (WriteLock, AbsoluteSeek, 0, 0)
if isNothing locked if isNothing locked
then return (Nothing, True) then do
closeFd fd
return (Nothing, True)
else do else do
void $ tryIO $ writeTransferInfoFile info tfile void $ tryIO $ writeTransferInfoFile info tfile
return (mfd, False) return (mfd, False)

3
debian/changelog vendored
View file

@ -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 if a key is present on a rsync remote, and when dropping a key from
the remote. the remote.
* Promote file not found warning message to an error. * 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 <joeyh@debian.org> Thu, 04 Sep 2014 16:17:22 -0400 -- Joey Hess <joeyh@debian.org> Thu, 04 Sep 2014 16:17:22 -0400

View file

@ -36,3 +36,7 @@ lsof -p <my annex process>
.../.git/annex/ssh/myserver.lock .../.git/annex/ssh/myserver.lock
.../.git/annex/transfer/upload/b4d67c4f-8cca-423c-9363-f3063b7fe3e4/lck.SHA256E-s10448418--4f61fab4... ~200 different files. .../.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]]