fix ssh warmup hang

Fix race condition in ssh warmup that caused git-annex to get stuck and
never process some while when run with high levels of concurrency.

So far, I've isolated the problem to processTranscript, which hangs
reading output from ssh in this situation. I don't yet understand why
processTranscript behaves that way.

Since here we don't care about the ssh output, and only want to /dev/null
it, changed to not use processTranscript, avoiding its problem.

This commit was supported by the NSF-funded DataLad project.
This commit is contained in:
Joey Hess 2018-03-15 15:00:19 -04:00
parent 7d83502329
commit ac6f58d642
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 32 additions and 3 deletions

View file

@ -34,7 +34,6 @@ import Annex.Path
import Utility.Env
import Utility.FileSystemEncoding
import Utility.Hash
import Utility.Process.Transcript
import Types.CleanupActions
import Types.Concurrency
import Git.Env
@ -219,13 +218,17 @@ prepSocket socketfile gc sshhost sshparams = do
-- return True.
-- (Except there's an unlikely false positive where a forced
-- ssh command exits 255.)
tryssh extraps = liftIO $ do
tryssh extraps = liftIO $ withNullHandle $ \nullh -> do
let p = proc "ssh" $ concat
[ extraps
, toCommand sshparams
, [fromSshHost sshhost, "true"]
]
(_, exitcode) <- processTranscript'' p Nothing
(Nothing, Nothing, Nothing, pid) <- createProcess $ p
{ std_out = UseHandle nullh
, std_err = UseHandle nullh
}
exitcode <- waitForProcess pid
return $ case exitcode of
ExitFailure 255 -> False
_ -> True