0

If I run:

sftp -oServerAliveInterval=10 server-2

Connection is established. But after increasing (decreasing) the value from 10 to 1:

sftp -oServerAliveInterval=1 server-2

I am unable to connect:

Connecting to server-2...
Connection closed by 10.0.1.10
Couldn't read packet: Connection reset by peer

Any ideas why?

Added -vvv:

debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: id_rsa (0xxxxxxxxxxx)
Connection to 10.0.1.10 timed out while waiting to read
Couldn't read packet: Connection reset by peer
  • check with verbose log (-vvv switches). It will give you the clue. – Jakuje Feb 25 '16 at 12:30
  • Nothing interesting: debug1: SSH2_MSG_SERVICE_ACCEPT received debug2: key: id_rsa (0xxxxxxxxxxx) Connection to 10.0.1.10 timed out while waiting to read Couldn't read packet: Connection reset by peer – meso_2600 Feb 25 '16 at 12:33
0

But after increasing (decreasing) the value from 10 to 1:

sftp -oServerAliveInterval=1 server-2

Setting ServerAliveInterval to 1 second starts timer after every read and if there are no other data, it queries the server for response. If defined amount of answers will not return (ServerAliveCountMax is also important in this context), then the connection is closed.

This is also related to TCPKeepAlive, which does basically the same without too much burden. The above mentioned options should be used only if the TCPKeepAlive is not effective and you see a lot of connection breakage.

Mentioning in your question why you did this would also help.

  • I know what this setting does, but I still do not know why it keeps disconnecting BEFORE the connection has been established. Why I did this? If there is such setting I would like to understand how it works – meso_2600 Feb 25 '16 at 14:02
  • and also because I do see a lot of connecion breakage – meso_2600 Feb 25 '16 at 14:09
  • To know why, you would have to post the whole -vvv output. I might have a look into that. It is possible that in this early stage the remote side is unable to answer you every second, so your client breaks the connection (as log proposes). – Jakuje Feb 25 '16 at 23:55
  • -vvv didnt provide much details. even strace did not provide anything interesting. During the connection I do not see additional packets being sent (iwth setting set to 1 or 10). – meso_2600 Feb 26 '16 at 14:33
0

Solved. Issue caused by internal bug in the app server running on Windows machine

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.