0 votes
by (120 points)

There is a file name length or files quantity limit to read with rebex?

I am moving files from sterling sftp to local and I got the following:

In the sterling folder exist more than 250 files, the filename length is between 95 and 100 so the connection closes when try to get the folder content.

If I try to read the folder content with 230 files it works.

I used Simple WinForm SFTP Clinet application and also I get the same error

Error WinForm SFTP Clinet:

12:14:49.284 Info Response: SSH_FXP_HANDLE (20, 0x33)
12:14:49.284 Info Command: SSH_FXP_READDIR (21, 0x33)
12:14:49.323 Error SSH: Rebex.Net.SshException: The connection was closed by the server.
   at Rebex.Net.SshSession.schh[dg,dh](gviu`2 anl, Int32 anm, gviv ann, dh ano, dg anp, dg anq)
   at Rebex.Net.SshSession.schg[dg,dh](gviu`2 anj, dh ank)
   at Rebex.Net.SshChannel.mfpa[dg,dh](gviu`2 aen, dh aeo)
   at Rebex.Net.SshChannel.mfpk(Byte[] afb, Int32 afc, Int32 afd)
   at Rebex.Net.SshChannel.Receive(Byte[] buffer, Int32 offset, Int32 count)
12:14:49.324 Error SSH: Rebex.Net.SshException: The channel has been closed.
   at Rebex.Net.SshChannel.mfpm(Byte[] afg, Int32 afh, Int32 afi)
   at Rebex.Net.SshChannel.Send(Byte[] buffer, Int32 offset, Int32 count)
12:14:49.324 Error Info: Rebex.Net.SshException: The connection was closed by the server.
   at Rebex.Net.SshSession.schh[dg,dh](gviu`2 anl, Int32 anm, gviv ann, dh ano, dg anp, dg anq)
   at Rebex.Net.SshSession.schg[dg,dh](gviu`2 anj, dh ank)
   at Rebex.Net.SshChannel.mfpa[dg,dh](gviu`2 aen, dh aeo)
   at Rebex.Net.SshChannel.mfpk(Byte[] afb, Int32 afc, Int32 afd)
   at Rebex.Net.SshChannel.Receive(Byte[] buffer, Int32 offset, Int32 count)
   at jqxx.jfmj(Byte[] m, Int32 n, Int32 o)
   at jqym.fqdt(Int32 arr)
   at jqym.fqdv(ydpp& aru)
   at jqym.fqds(UInt32 arp, Boolean arq)
   at jqym.fqdr(ydpp arm, UInt32 arn, jqxw aro)
   at jqym.fqdc(jqyi apv, jqxw apw)
   at Rebex.Net.Sftp.sebj(String su, Regex sv, jqxw sw, ydql sx)
Applies to: Rebex SFTP
by (148k points)
Based on your description and the error message, this actually looks like there is some kind of a limit, but it's server-side, not client-side. It almost seems as if this SFTP server fails and closes a connection if it is unable to fit the whole listing into a single SSH packet.

The client's SSH_FXP_READDIR request basically means "give me information about as many items as you can", so if the server reacts by closing the connection, it clearly indicates a server-side issue.

Are you able to list this directory using any third-party SFTP/SSH client app?
by (120 points)
I only try with Filezilla and It shows all files without any problem
and  WinForm SFTP Clinet but fails with more than 230 files

1 Answer

0 votes
by (148k points)

Please try lowering Rebex SFTP's maximum SSH packet size to 16384 and let us know whether this has any effect:

var client = new Sftp();
client.Settings.SshParameters.MaximumPacketSize = 16384;
client.Connect(...);
by (120 points)
It function, I need to install 2019 R4.2 version to set MaximumPacketSize value,
but what is the problem, the filename  length or files quantity?
by (120 points)
How can I fix it using Rebex dll 2018 R1.1 version?
by (148k points)
The problem is at server side - the server SFTP software contains a bug that makes it crash while constructing a response to SSH_FXP_READDIR once the total size of the response exceeds some apparently built-in limit. Looks like some buffer overflow issue - to learn more, please report this to the server vendor. Setting a shorted MaximumPacketSize value causes the client to announce support for short SSH packets only, which mitigates the issue.

It's not possible to specify maximum packet size in 2018 R1.1, but please contact us at support@rebex.net with your contract details (such as an e-mail or order number) and we'll try to help.
...