From 983c9d5a53189f71797591692c0ed675f5bd1c16 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 6 Nov 2018 13:00:25 -0400 Subject: [PATCH] git-annex-shell: fix transfer hang Fix hang when transferring the same objects to two different clients at the same time. (Or when annex.pidlock is used, two different objects to the same or different clients.) Could also potentially occur if a client was downloading an object and somehow lost connection but that git-annex-shell was still running and holding the transfer lock. This does not guarantee that, if `transfer` fails for some other reason, a DATA response will be made. This work is supported by the NIH-funded NICEMAN (ReproNim TR&D3) project. --- Annex/Transfer.hs | 5 +++++ CHANGELOG | 8 ++++++++ P2P/Annex.hs | 3 ++- .../comment_27_0f2e6c7dbfbb3007d4e3f7faa63d16b4._comment | 8 ++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 doc/bugs/annex_get_-J_16_via_ssh_stalls_/comment_27_0f2e6c7dbfbb3007d4e3f7faa63d16b4._comment diff --git a/Annex/Transfer.hs b/Annex/Transfer.hs index b207005412..175e06add5 100644 --- a/Annex/Transfer.hs +++ b/Annex/Transfer.hs @@ -10,6 +10,7 @@ module Annex.Transfer ( module X, upload, + alwaysUpload, download, runTransfer, alwaysRunTransfer, @@ -39,6 +40,10 @@ upload :: Observable v => UUID -> Key -> AssociatedFile -> RetryDecider -> (Mete upload u key f d a _witness = guardHaveUUID u $ runTransfer (Transfer Upload u key) f d a +alwaysUpload :: Observable v => UUID -> Key -> AssociatedFile -> RetryDecider -> (MeterUpdate -> Annex v) -> NotifyWitness -> Annex v +alwaysUpload u key f d a _witness = guardHaveUUID u $ + alwaysRunTransfer (Transfer Upload u key) f d a + download :: Observable v => UUID -> Key -> AssociatedFile -> RetryDecider -> (MeterUpdate -> Annex v) -> NotifyWitness -> Annex v download u key f d a _witness = guardHaveUUID u $ runTransfer (Transfer Download u key) f d a diff --git a/CHANGELOG b/CHANGELOG index 8ca1845507..854f6ae197 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,11 @@ +git-annex (7.20181106) UNRELEASED; urgency=medium + + * git-annex-shell: Fix hang when transferring the same objects to two + different clients at the same time. (Or when annex.pidlock is used, + two different objects.) + + -- Joey Hess Tue, 06 Nov 2018 12:44:27 -0400 + git-annex (7.20181105) upstream; urgency=medium * Fix test suite failure when git-annex test is not run inside a git diff --git a/P2P/Annex.hs b/P2P/Annex.hs index a08b923176..356d474046 100644 --- a/P2P/Annex.hs +++ b/P2P/Annex.hs @@ -59,7 +59,8 @@ runLocal runst runner a = case a of v <- tryNonAsync $ prepSendAnnex k case v of Right (Just (f, checkchanged)) -> proceed $ - transfer upload k af $ + -- Allow multiple uploads of the same key. + transfer alwaysUpload k af $ sinkfile f o checkchanged sender Right Nothing -> proceed $ runner (sender mempty (return Invalid)) diff --git a/doc/bugs/annex_get_-J_16_via_ssh_stalls_/comment_27_0f2e6c7dbfbb3007d4e3f7faa63d16b4._comment b/doc/bugs/annex_get_-J_16_via_ssh_stalls_/comment_27_0f2e6c7dbfbb3007d4e3f7faa63d16b4._comment new file mode 100644 index 0000000000..77857611f8 --- /dev/null +++ b/doc/bugs/annex_get_-J_16_via_ssh_stalls_/comment_27_0f2e6c7dbfbb3007d4e3f7faa63d16b4._comment @@ -0,0 +1,8 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 27""" + date="2018-11-06T16:55:17Z" + content=""" +Preliminary fix in place, but have not yet done anything more to guarantee that +other failures don't prevent it from sending DATA. +"""]]