Run ssh with ServerAliveInterval 60
So that stalled transfers will be noticed within about 3 minutes, even if TCPKeepAlive is disabled or doesn't work. Rather than setting with -o, use -F with another config file, so that any settings in ~/.ssh/config or /etc/ssh/ssh_config overrides this.
This commit is contained in:
parent
075602b1df
commit
0ae08947ac
5 changed files with 45 additions and 11 deletions
|
@ -63,6 +63,7 @@ module Annex.Locations (
|
||||||
gitAnnexUrlFile,
|
gitAnnexUrlFile,
|
||||||
gitAnnexTmpCfgFile,
|
gitAnnexTmpCfgFile,
|
||||||
gitAnnexSshDir,
|
gitAnnexSshDir,
|
||||||
|
gitAnnexSshConfig,
|
||||||
gitAnnexRemotesDir,
|
gitAnnexRemotesDir,
|
||||||
gitAnnexAssistantDefaultDir,
|
gitAnnexAssistantDefaultDir,
|
||||||
HashLevels(..),
|
HashLevels(..),
|
||||||
|
@ -402,6 +403,10 @@ gitAnnexTmpCfgFile r = gitAnnexDir r </> "config.tmp"
|
||||||
gitAnnexSshDir :: Git.Repo -> FilePath
|
gitAnnexSshDir :: Git.Repo -> FilePath
|
||||||
gitAnnexSshDir r = addTrailingPathSeparator $ gitAnnexDir r </> "ssh"
|
gitAnnexSshDir r = addTrailingPathSeparator $ gitAnnexDir r </> "ssh"
|
||||||
|
|
||||||
|
{- .git/annex/ssh.config is used to configure ssh. -}
|
||||||
|
gitAnnexSshConfig :: Git.Repo -> FilePath
|
||||||
|
gitAnnexSshConfig r = gitAnnexDir r </> "ssh.config"
|
||||||
|
|
||||||
{- .git/annex/remotes/ is used for remote-specific state. -}
|
{- .git/annex/remotes/ is used for remote-specific state. -}
|
||||||
gitAnnexRemotesDir :: Git.Repo -> FilePath
|
gitAnnexRemotesDir :: Git.Repo -> FilePath
|
||||||
gitAnnexRemotesDir r = addTrailingPathSeparator $ gitAnnexDir r </> "remotes"
|
gitAnnexRemotesDir r = addTrailingPathSeparator $ gitAnnexDir r </> "remotes"
|
||||||
|
|
35
Annex/Ssh.hs
35
Annex/Ssh.hs
|
@ -33,6 +33,7 @@ import qualified Git.Url
|
||||||
import Config
|
import Config
|
||||||
import Annex.Path
|
import Annex.Path
|
||||||
import Utility.Env
|
import Utility.Env
|
||||||
|
import Utility.Tmp
|
||||||
import Types.CleanupActions
|
import Types.CleanupActions
|
||||||
import Git.Env
|
import Git.Env
|
||||||
#ifndef mingw32_HOST_OS
|
#ifndef mingw32_HOST_OS
|
||||||
|
@ -49,13 +50,33 @@ sshOptions (host, port) gc opts = go =<< sshCachingInfo (host, port)
|
||||||
go (Just socketfile, params) = do
|
go (Just socketfile, params) = do
|
||||||
prepSocket socketfile
|
prepSocket socketfile
|
||||||
ret params
|
ret params
|
||||||
ret ps = return $ concat
|
ret ps = do
|
||||||
[ ps
|
overideconfigfile <- fromRepo gitAnnexSshConfig
|
||||||
, map Param (remoteAnnexSshOptions gc)
|
-- We assume that the file content does not change.
|
||||||
, opts
|
-- If it did, a more expensive test would be needed.
|
||||||
, portParams port
|
liftIO $ unlessM (doesFileExist overideconfigfile) $
|
||||||
, [Param "-T"]
|
viaTmp writeFile overideconfigfile $ unlines
|
||||||
]
|
-- ssh expands "~"
|
||||||
|
[ "Include ~/.ssh/config"
|
||||||
|
-- ssh will silently skip the file
|
||||||
|
-- if it does not exist
|
||||||
|
, "Include /etc/ssh/ssh_config"
|
||||||
|
-- Everything below this point is only
|
||||||
|
-- used if there's no setting for it in
|
||||||
|
-- the above files.
|
||||||
|
--
|
||||||
|
-- Make sure that ssh detects stalled
|
||||||
|
-- connections.
|
||||||
|
, "ServerAliveInterval 60"
|
||||||
|
]
|
||||||
|
return $ concat
|
||||||
|
[ ps
|
||||||
|
, [Param "-F", File overideconfigfile]
|
||||||
|
, map Param (remoteAnnexSshOptions gc)
|
||||||
|
, opts
|
||||||
|
, portParams port
|
||||||
|
, [Param "-T"]
|
||||||
|
]
|
||||||
|
|
||||||
{- Returns a filename to use for a ssh connection caching socket, and
|
{- Returns a filename to use for a ssh connection caching socket, and
|
||||||
- parameters to enable ssh connection caching. -}
|
- parameters to enable ssh connection caching. -}
|
||||||
|
|
|
@ -14,6 +14,10 @@ git-annex (6.20161013) UNRELEASED; urgency=medium
|
||||||
NFS sometimes puts in a directory when a file is being deleted.
|
NFS sometimes puts in a directory when a file is being deleted.
|
||||||
* If a transfer fails for some reason, but some data managed to be sent,
|
* If a transfer fails for some reason, but some data managed to be sent,
|
||||||
the transfer will be retried. (The assistant already did this.)
|
the transfer will be retried. (The assistant already did this.)
|
||||||
|
* Run ssh with ServerAliveInterval 60, so that stalled transfers will
|
||||||
|
be noticed within about 3 minutes.
|
||||||
|
(Any setting in your ~/.ssh/config or /etc/ssh/ssh_config
|
||||||
|
overrides this.)
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Mon, 17 Oct 2016 12:46:54 -0400
|
-- Joey Hess <id@joeyh.name> Mon, 17 Oct 2016 12:46:54 -0400
|
||||||
|
|
||||||
|
|
|
@ -59,3 +59,5 @@ SHA256E-s41311329--69c3b054a3fe9676133605730d85b7fcef8696f6782d402a524e41b836253
|
||||||
|
|
||||||
|
|
||||||
[[!meta title="Detect stalled transfer and retry or abort it"]]
|
[[!meta title="Detect stalled transfer and retry or abort it"]]
|
||||||
|
|
||||||
|
> [[done]] --[[Joey]]
|
||||||
|
|
|
@ -6,12 +6,12 @@
|
||||||
On the ssh config, one way to do it is to pass -F with a config
|
On the ssh config, one way to do it is to pass -F with a config
|
||||||
file that git-annex generates. It could look like:
|
file that git-annex generates. It could look like:
|
||||||
|
|
||||||
Include ~/.ssh/ssh.config
|
Include ~/.ssh/config
|
||||||
Include /etc/ssh/ssh.config
|
Include /etc/ssh/ssh_config
|
||||||
ServerAliveInterval 60
|
ServerAliveInterval 60
|
||||||
|
|
||||||
Since ssh uses the first config setting it sees, if ~/.ssh/ssh.config
|
Since ssh uses the first config setting it sees, if `~/.ssh/config`
|
||||||
or /etc/ssh/ssh.config set a ServerAliveInterval that one will be used,
|
or `/etc/ssh/ssh_config` set a ServerAliveInterval that one will be used,
|
||||||
and otherwise the value git-annex sets will be used.
|
and otherwise the value git-annex sets will be used.
|
||||||
|
|
||||||
But.. Ssh enables TCPKeepAlive by default. You'd think that would be enough
|
But.. Ssh enables TCPKeepAlive by default. You'd think that would be enough
|
||||||
|
@ -23,4 +23,6 @@ or a firewall does not support it.
|
||||||
|
|
||||||
If the problem is that users are disabling TCPKeepAlive, then
|
If the problem is that users are disabling TCPKeepAlive, then
|
||||||
having git-annex enable ServerAliveInterval makes sense.
|
having git-annex enable ServerAliveInterval makes sense.
|
||||||
|
|
||||||
|
Ok; implemented this.
|
||||||
"""]]
|
"""]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue