System.ArgumentException: Destination array was not long enough.

0 votes
asked Jul 9, 2016 by ChazRowe (130 points)

I'm doing some stress testing using Rebex file server beta build 6010.

I'm spawning three clients and uploading 10 MB files of binary files generated with random data.

Occasionally the server disconnects one of the clients in the middle of a transfer. Here's a fragment of a debug log showing the error:

2016-07-08 19:35:30.556 INFO FileServer(1)[15] Server: Session 2: Authentication for 'user' succeeded.
2016-07-08 19:35:30.556 INFO FileServer(1)[25] Server: Session 3: Authentication for 'user' succeeded.
2016-07-08 19:35:30.556 INFO FileServer(1)[23] Server: Session 1: Authentication for 'user' succeeded.
2016-07-08 19:35:31.487 DEBUG FileServer(1)[15] SSH: Session 2: Authenticated as 'user' for 'ssh-connection'.
2016-07-08 19:35:31.487 DEBUG FileServer(1)[25] SSH: Session 3: Authenticated as 'user' for 'ssh-connection'.
2016-07-08 19:35:31.487 DEBUG FileServer(1)[23] SSH: Session 1: Authenticated as 'user' for 'ssh-connection'.
2016-07-08 19:35:31.514 DEBUG FileServer(1)[15] Server: Session 2: Starting SftpModule(1) subsystem.
2016-07-08 19:35:31.514 DEBUG FileServer(1)[23] Server: Session 3: Starting SftpModule(2) subsystem.
2016-07-08 19:35:31.514 DEBUG FileServer(1)[25] Server: Session 1: Starting SftpModule(3) subsystem.
2016-07-08 19:35:32.054 DEBUG SftpModule(2)[27] SFTP: Opening file '/A8-B3-AE-58-78-B4-B5-29-45-ED-1A-29-53-2D-87-CB' (Create, Write): success.
2016-07-08 19:35:32.060 DEBUG SftpModule(1)[30] SFTP: Opening file '/D9-B6-0D-1A-4F-CC-04-09-BA-02-62-45-0B-0D-41-A9' (Create, Write): success.
2016-07-08 19:35:32.740 DEBUG SftpModule(3)[30] SFTP: Opening file '/B8-C0-AA-D5-13-3A-5B-B1-FF-2F-46-7A-4F-B4-79-F3' (Create, Write): success.
2016-07-08 19:35:32.740 DEBUG SftpModule(2)[11] SFTP: Closing file '/A8-B3-AE-58-78-B4-B5-29-45-ED-1A-29-53-2D-87-CB': success.
2016-07-08 19:35:32.741 DEBUG SftpModule(1)[12] SFTP: Closing file '/D9-B6-0D-1A-4F-CC-04-09-BA-02-62-45-0B-0D-41-A9': success.
2016-07-08 19:35:32.876 DEBUG SftpModule(1)[12] SFTP: Opening file '/64-C0-4A-41-89-2B-77-84-CE-A6-3E-AF-E3-F8-4F-1C' (Create, Write): success.
2016-07-08 19:35:32.879 DEBUG SftpModule(2)[31] SFTP: Opening file '/5B-89-5B-01-58-F7-FB-33-BB-05-42-E7-F8-5D-FF-6A' (Create, Write): success.
2016-07-08 19:35:33.057 ERROR SftpModule(1)[25] Server: Session 1: Error: System.ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds.
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
   at Rebex.Net.Protocols.RBJ.TT(Byte[] B, Int32 T, Int32 J)
2016-07-08 19:35:33.119 DEBUG SftpModule(1)[25] SFTP: Closing file '/64-C0-4A-41-89-2B-77-84-CE-A6-3E-AF-E3-F8-4F-1C': success.
2016-07-08 19:35:34.555 INFO FileServer(1)[26] SSH: Session 2: Connection closed by the remote host.
2016-07-08 19:35:34.560 INFO FileServer(1)[26] Server: Session 2: Closed connection from 127.0.0.1:17331.
2016-07-08 19:35:34.662 DEBUG FileServer(1)[15] Server: Accepted connection from 127.0.0.1:17373.
2016-07-08 19:35:35.577 INFO FileServer(1)[15] Server: Session 4: Started on connection from 127.0.0.1:17373.
2016-07-08 19:35:35.577 DEBUG FileServer(1)[15] SSH: Session 4: Local SSH version: SSH-2.0-RebexSSH_1.0.6010.2
2016-07-08 19:35:35.578 DEBUG FileServer(1)[26] SSH: Session 4: Remote SSH version: SSH-2.0-RebexSSH_3.0.6010.2
2016-07-08 19:35:35.578 DEBUG FileServer(1)[26] SSH: Session 4: Performing algorithm negotiation and key exchange.
2016-07-08 19:35:35.582 DEBUG FileServer(1)[26] SSH: Session 4: Performing key exchange using diffie-hellman-group-exchange-sha256 with ssh-rsa.
2016-07-08 19:35:35.684 DEBUG FileServer(1)[24] SSH: Session 4: Current encryptor is aes256-ctr/hmac-sha2-256.
2016-07-08 19:35:35.709 DEBUG FileServer(1)[15] SSH: Session 4: Current decryptor is aes256-ctr/hmac-sha2-256.
2016-07-08 19:35:35.709 DEBUG FileServer(1)[15] SSH: Session 4: Key exchange finished.

Any ideas?

Also, if a client disconnects in mid transfer, is there any way to identify which file was incomplete?

Thanks,
-Chaz

Applies to: Rebex SFTP

1 Answer

+1 vote
answered Jul 11, 2016 by Lukas Pokorny (82,430 points)

This looks like a bug in SFTP subsystem's data buffering that has been fixed in Rebex File Server 2016 R2.

However, you seem to be using a beta build with preliminary IFilesystem support - please download the current beta build that incorporates all 2016 R2 changes and give it a try. If the issue persists, let us know.

commented Jul 11, 2016 by ChazRowe (130 points)
That was it!

Thanks.
-chaz
...