From 87f28bb2ea2dd7c9eef6b3abe38f8839981fd620 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 19 May 2015 23:46:42 -0400 Subject: [PATCH] ignore failure to clean up stale transfer lock file Perhaps due to permissions problem, or perhaps a race with another process also cleaning up. --- Logs/Transfer.hs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Logs/Transfer.hs b/Logs/Transfer.hs index 471b886b3a..af6d19da61 100644 --- a/Logs/Transfer.hs +++ b/Logs/Transfer.hs @@ -145,13 +145,15 @@ checkTransfer t = do StatusNoLockFile -> return Nothing StatusUnLocked -> do -- Take a non-blocking lock while deleting - -- the stale lock file. - r <- tryLockExclusive Nothing lck - case r of - Just lockhandle -> do - cleanstale - dropLock lockhandle - _ -> noop + -- the stale lock file. Ignore failure + -- due to permissions problems, races, etc. + void $ tryIO $ do + r <- tryLockExclusive Nothing lck + case r of + Just lockhandle -> do + cleanstale + dropLock lockhandle + _ -> noop return Nothing #else v <- liftIO $ lockShared $ transferLockFile tfile