aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-10-26 16:41:34 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-10-26 16:41:34 -0400
commite356796fc7ee493ff6b6a7e9cbcbc2971ab23729 (patch)
treee65a038719daea8c871a435cb0d03ddcbd482783
parentd3c4be40c05e107b39b08a918dfb3ec991444d6e (diff)
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.
-rw-r--r--Annex/Locations.hs5
-rw-r--r--Annex/Ssh.hs35
-rw-r--r--CHANGELOG4
-rw-r--r--doc/bugs/Allow_automatic_retry_git_annex_get.mdwn2
-rw-r--r--doc/bugs/Allow_automatic_retry_git_annex_get/comment_3_8b54b726c7d89587e62b6281c9cd915a._comment10
5 files changed, 45 insertions, 11 deletions
diff --git a/Annex/Locations.hs b/Annex/Locations.hs
index a6af4d417..9f829fda1 100644
--- a/Annex/Locations.hs
+++ b/Annex/Locations.hs
@@ -63,6 +63,7 @@ module Annex.Locations (
gitAnnexUrlFile,
gitAnnexTmpCfgFile,
gitAnnexSshDir,
+ gitAnnexSshConfig,
gitAnnexRemotesDir,
gitAnnexAssistantDefaultDir,
HashLevels(..),
@@ -402,6 +403,10 @@ gitAnnexTmpCfgFile r = gitAnnexDir r </> "config.tmp"
gitAnnexSshDir :: Git.Repo -> FilePath
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. -}
gitAnnexRemotesDir :: Git.Repo -> FilePath
gitAnnexRemotesDir r = addTrailingPathSeparator $ gitAnnexDir r </> "remotes"
diff --git a/Annex/Ssh.hs b/Annex/Ssh.hs
index 4f879436b..43c2c13a9 100644
--- a/Annex/Ssh.hs
+++ b/Annex/Ssh.hs
@@ -33,6 +33,7 @@ import qualified Git.Url
import Config
import Annex.Path
import Utility.Env
+import Utility.Tmp
import Types.CleanupActions
import Git.Env
#ifndef mingw32_HOST_OS
@@ -49,13 +50,33 @@ sshOptions (host, port) gc opts = go =<< sshCachingInfo (host, port)
go (Just socketfile, params) = do
prepSocket socketfile
ret params
- ret ps = return $ concat
- [ ps
- , map Param (remoteAnnexSshOptions gc)
- , opts
- , portParams port
- , [Param "-T"]
- ]
+ ret ps = do
+ overideconfigfile <- fromRepo gitAnnexSshConfig
+ -- We assume that the file content does not change.
+ -- If it did, a more expensive test would be needed.
+ liftIO $ unlessM (doesFileExist overideconfigfile) $
+ 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
- parameters to enable ssh connection caching. -}
diff --git a/CHANGELOG b/CHANGELOG
index c4016ef35..f54bb520d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -14,6 +14,10 @@ git-annex (6.20161013) UNRELEASED; urgency=medium
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,
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
diff --git a/doc/bugs/Allow_automatic_retry_git_annex_get.mdwn b/doc/bugs/Allow_automatic_retry_git_annex_get.mdwn
index c6e406b49..0e85b7acf 100644
--- a/doc/bugs/Allow_automatic_retry_git_annex_get.mdwn
+++ b/doc/bugs/Allow_automatic_retry_git_annex_get.mdwn
@@ -59,3 +59,5 @@ SHA256E-s41311329--69c3b054a3fe9676133605730d85b7fcef8696f6782d402a524e41b836253
[[!meta title="Detect stalled transfer and retry or abort it"]]
+
+> [[done]] --[[Joey]]
diff --git a/doc/bugs/Allow_automatic_retry_git_annex_get/comment_3_8b54b726c7d89587e62b6281c9cd915a._comment b/doc/bugs/Allow_automatic_retry_git_annex_get/comment_3_8b54b726c7d89587e62b6281c9cd915a._comment
index 855a6876d..12c31dc11 100644
--- a/doc/bugs/Allow_automatic_retry_git_annex_get/comment_3_8b54b726c7d89587e62b6281c9cd915a._comment
+++ b/doc/bugs/Allow_automatic_retry_git_annex_get/comment_3_8b54b726c7d89587e62b6281c9cd915a._comment
@@ -6,12 +6,12 @@
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:
- Include ~/.ssh/ssh.config
- Include /etc/ssh/ssh.config
+ Include ~/.ssh/config
+ Include /etc/ssh/ssh_config
ServerAliveInterval 60
-Since ssh uses the first config setting it sees, if ~/.ssh/ssh.config
-or /etc/ssh/ssh.config set a ServerAliveInterval that one will be used,
+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,
and otherwise the value git-annex sets will be used.
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
having git-annex enable ServerAliveInterval makes sense.
+
+Ok; implemented this.
"""]]