Help troubleshooting SocketException "An established connection was aborted by the software in your host machine"

0 votes
asked Oct 19, 2016 by ajryan (120 points)
edited Oct 19, 2016 by ajryan

We have a scheduled job that retrieves new files from an SFTP server every 20 minutes. About 1 in 200 attempts, the job fails with SocketException: An established connection was aborted by the software in your host machine.

This apparently corresponds to TCP/IP socket error WSAECONNABORTED.

We are trying to determine whether the problem lies in our infrastructure, the remote server, or perhaps in Rebex's SFTP implementation's compatibility with this particular system. We use Rebex SFTP successfully with many other servers with much higher reliability. The remote system is Solaris SSHD and our partner has a lot of traffic so they are unable to enable verbose logging because it would flood their disk. Are there any other techniques we can use to troubleshoot?

A complete example log is below. Note that this error occurs at various times during a session, sometimes during or just after authentication (as below), sometimes while waiting for response to an LS command, or somtimes during a file download.

We have inspected our firewall logs and found no blocking/filtering has occurred (our partner has done so as well and found no blocking/filtering).

When the error occurs we have tried FileZilla within a minute or so with no errors. Retrying about a minute later with RebEx is successful as well.

2016-10-19 06:43:04.165 INFO Sftp(4871)[29] Info: Connecting to xxxx.xxxx.com:1139 using Sftp 3.0.5584.0.
2016-10-19 06:43:04.321 DEBUG Sftp(4871)[29] SSH: Server is 'SSH-2.0-Sun_SSH_1.1.6'.
2016-10-19 06:43:04.321 INFO Sftp(4871)[29] SSH: Negotiation started.
2016-10-19 06:43:04.587 DEBUG Sftp(4871)[29] SSH: Group exchange.
2016-10-19 06:43:04.680 DEBUG Sftp(4871)[29] SSH: Negotiating key.
2016-10-19 06:43:04.821 DEBUG Sftp(4871)[29] SSH: Validating signature.
2016-10-19 06:43:04.821 INFO Sftp(4871)[29] SSH: Negotiation finished.
2016-10-19 06:43:04.821 INFO Sftp(4871)[29] Info: Server: SSH-2.0-Sun_SSH_1.1.6
2016-10-19 06:43:04.821 INFO Sftp(4871)[29] Info: Fingerprint: xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
2016-10-19 06:43:04.821 INFO Sftp(4871)[29] Info: Cipher info: SSH 2.0, DiffieHellmanGroupExchangeSHA1, DSS, aes256-    ctr/aes256-ctr, hmac-sha1/hmac-sha1
2016-10-19 06:43:11.321 DEBUG Sftp(4871)[29] SSH: Allowed authentication methods: gssapi-keyex, gssapi-with-mic, publickey, password, keyboard-interactive.
2016-10-19 06:43:11.321 DEBUG Sftp(4871)[29] SSH: Trying password authentication for 'xxxxxxxxxxxxxxxx'.
2016-10-19 06:43:11.587 DEBUG Sftp(4871)[29] SSH: Authentication successful.
2016-10-19 06:43:11.665 ERROR Sftp(4871)[29] SSH: Rebex.Net.SshException: The connection was aborted. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
   at Rebex.Net.ProxySocket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at Rebex.Net.SshSession.SY(Int32 A)
   --- End of inner exception stack trace ---
   at Rebex.Net.SshSession.SY(Int32 A)
   at Rebex.Net.SshSession.VY(Byte[]& A)
   at Rebex.Net.SshSession.YY(NGB A, Object[] B)
   at Rebex.Net.SshSession.OZ(SshChannelType A, Int32 B, Object[] C)
2016-10-19 06:43:11.665 ERROR Sftp(4871)[29] Info: Rebex.Net.SshException: The connection was aborted. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
   at Rebex.Net.ProxySocket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at Rebex.Net.SshSession.SY(Int32 A)
   --- End of inner exception stack trace ---
   at Rebex.Net.SshSession.SY(Int32 A)
   at Rebex.Net.SshSession.VY(Byte[]& A)
   at Rebex.Net.SshSession.YY(NGB A, Object[] B)
   at Rebex.Net.SshSession.OZ(SshChannelType A, Int32 B, Object[] C)
   at Rebex.Net.SshSession.OpenChannel(SshChannelType type, Int32 bufferSize)
   at Rebex.Net.Sftp.LBB(XMB A)
   at Rebex.Net.Sftp.IP(String A, String B, SshPrivateKey C, XMB D)
Applies to: Rebex SFTP

1 Answer

0 votes
answered Oct 19, 2016 by Tomas Knopp (58,890 points)

You can use WireShark to find out what is actually closing the connection.

We've learnt that the error message from the System.Net.Sockets.SocketException "An established connection was aborted by the software in your host machine"
is sometimes misleading. E.g. it does not have to be a software in your host machine at all.

Please create a WireShark log (either at your client machine, or somewhere along the route) and check who was closing the connection.
If you find it is at the client, let us know and we will be investigating the issue further.
If the connection was closed by the server, the only thing you can do is to look into the server log and find there some additional information as to why the server has closed the connection
in this particular case.

...