Problem: Connection closed remotely, posted file has 0 KB

0 votes
asked Sep 12, 2011 by dougFromMaine (160 points)
edited Sep 13, 2011

Hi,

I purchased Rebex SFTP almost two years ago and used it to build a system (.net/c#) part of which posts XML messages to an external SFTP site. As of spring 2010 when the project was put on hold, it was working just fine.

Now we have re-started the project and in testing the SFTP component, I find it no longer works. Nothing changed other than some literals used in the XML file contents and re-compiling to make a new .exe.

When I try to post a file, I get the message "Connection has been closed by the remote connection end; disconnected by application.". The file is posted, but it is empty, i.e. 0 KB. My local copy of the file is 20-25 KB. Using the same credentials, I can post the same file manually using Bitvise SFTP without issue.

I read through your forums and found the suggestion about debug logging, which I added. The debug log appears below. (I check if the file already exists before posting, which is the "no such file" message) Since this component was already tested nearly two years ago, I didn't anticipate any problems.... but I'm now in a bind since we are going live in just a couple of days. Help!!

Thanks in advance,
- Doug

DEBUG LOG:
2011-12-09 18:32:24.876 Opening log file.
2011-12-09 18:33:01.299 Opening log file.
2011-12-09 18:33:01.518 INFO Sftp(1) Info: Connecting to sftp.TARGETSITE.com:22 using Sftp 2.0.3588.0.
2011-12-09 18:33:01.784 DEBUG Sftp(1) SSH: Server is 'SSH-2.0-1.82 sshlib: sshlibSrSshServer 1.00'.
2011-12-09 18:33:01.799 DEBUG Sftp(1) SSH: Negotiation started.
2011-12-09 18:33:01.940 DEBUG Sftp(1) SSH: Group exchange.
2011-12-09 18:33:02.190 DEBUG Sftp(1) SSH: Negotiating key.
2011-12-09 18:33:02.346 DEBUG Sftp(1) SSH: Validating signature.
2011-12-09 18:33:02.377 DEBUG Sftp(1) SSH: Negotiation finished.
2011-12-09 18:33:02.377 INFO Sftp(1) Info: Server: SSH-2.0-1.82 sshlib: sshlibSrSshServer 1.00
2011-12-09 18:33:02.377 INFO Sftp(1) Info: Fingerprint: c7:b3:c2:cd:17:d0:d6:86:88:11:d4:06:ee:22:d4:64
2011-12-09 18:33:02.377 INFO Sftp(1) Info: Cipher info: SSH 2.0, DiffieHellmanGroupExchangeSHA1, DSS, 256bit AES/256bit AES, SHA1/SHA1, ZLIB/ZLIB
2011-12-09 18:33:02.737 DEBUG Sftp(1) SSH: Allowed authentication methods: publickey, password.
2011-12-09 18:33:02.737 DEBUG Sftp(1) SSH: Trying password authentication.
2011-12-09 18:33:02.862 DEBUG Sftp(1) SSH: Authentication successful.
2011-12-09 18:33:02.909 DEBUG Sftp(1) SSH: Requesting subsystem 'sftp'.
2011-12-09 18:33:02.971 INFO Sftp(1) Command: SSH_FXP_INIT (4)
2011-12-09 18:33:03.018 INFO Sftp(1) Response: SSH_FXP_VERSION (3, 0 extensions)
2011-12-09 18:33:03.018 INFO Sftp(1) Info: Using SFTP v3.
2011-12-09 18:33:03.018 INFO Sftp(1) Command: SSH_FXP_REALPATH (1, '.')
2011-12-09 18:33:03.081 INFO Sftp(1) Response: SSH_FXP_NAME (1, 1 item)
2011-12-09 18:33:03.081 INFO Sftp(1) Info: Current directory is '/'.
2011-12-09 18:33:03.081 INFO Sftp(1) Command: SSH_FXP_STAT (2, '/Orders/1683129.xml')
2011-12-09 18:33:03.127 INFO Sftp(1) Response: SSH_FXP_STATUS (2, 2, 'No such file.')
2011-12-09 18:33:03.143 INFO Sftp(1) Command: SSH_FXP_OPEN (3, '/Orders/1683129.xml', 26)
2011-12-09 18:33:03.190 INFO Sftp(1) Response: SSH_FXP_HANDLE (3, 0x3035666662326338)
2011-12-09 18:33:03.268 ERROR Sftp(1) SSH: Rebex.Net.SshException: Connection has been closed by the remote connection end; disconnected by application. .
at Rebex.Net.SshSession.1758130641(Byte[] , Int32 , Int32 )
at Rebex.Net.SshSession.3844343009(Byte[] , Int32 , Int32 )
at Rebex.Net.SshSession.15774055219(Int64& , Boolean )
at Rebex.Net.SshChannel.179601841(Boolean )
at Rebex.Net.SshChannel.Send(Byte[] buffer, Int32 offset, Int32 count)
2011-12-09 18:33:03.268 ERROR Sftp(1) SSH: Rebex.Net.SshException: The channel has been closed.
at Rebex.Net.SshChannel.179601841(Boolean )
at Rebex.Net.SshChannel.Send(Byte[] buffer, Int32 offset, Int32 count)
2011-12-09 18:33:03.284 ERROR Sftp(1) Info: Rebex.Net.SshException: Connection has been closed by the remote connection end; disconnected by application. .
at Rebex.Net.SshSession.1758130641(Byte[] , Int32 , Int32 )
at Rebex.Net.SshSession.3844343009(Byte[] , Int32 , Int32 )
at Rebex.Net.SshSession.15774055219(Int64& , Boolean )
at Rebex.Net.SshChannel.179601841(Boolean )
at Rebex.Net.SshChannel.Send(Byte[] buffer, Int32 offset, Int32 count)
at 328075837.610525840.1685053200(11634889349 )
at 328075837.610525840.1685053200(11634889349 , UInt32 )
at Rebex.Net.Sftp.1755417992(647307492 , Object , String , Stream , Int64 , Int64 )

Applies to: Rebex SFTP

2 Answers

0 votes
answered Sep 13, 2011 by Lukas Pokorny (100,710 points)
edited Sep 13, 2011

This looks like a known bug in ZLIB compression routine of Rebex SFTP v2.0.3588.0 that causes connection failures when uploading data to servers based on sshlib library (such as Bitvise or GlobalScape).

A quick workaround is disabling data compression, as described in the SFTP tutorial (no need to specify any of the other parameters).

(This bug has been fixed in Rebex SFTP v2.0.3793.0.)

0 votes
answered Sep 13, 2011 by dougFromMaine (160 points)
edited Sep 13, 2011

Thank you Lukas - that solved the problem!

After reviewing the example in your tutorial, it took about 30 seconds to add the code (in bold) below:

private SshParameters SshPAR = new SshParameters();

myObj.Connect(myApp.config.Default.FTPSite, 22, SshPAR);

  • Doug
...