+1 vote
by (130 points)
edited by

Hello. We have recently started noticing an odd type of exception being thrown by our product. In some cases, when attempting to dispose of an Rebex SFTP stream, we get this exception: Error: Rebex.Net.SftpException: Failure; Transfer failed.

However, this only happens when we attempt to dispose of the object (and the Close() method is called).

The stack trace is as follows:

at Rebex.Net.VNB.IC(OMB A, Type B)
at Rebex.Net.VNB.MB(SNB A, Boolean B, XMB C)
at Rebex.Net.APB.I()
at Rebex.AMB.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at [our method name goes here]

However, as I mentioned, this only happens with some files (in a consistent manner, as I could debug it in production) when attempting to dispose of the object. The actual transfers work fine and the operations complete successfully, which makes the "Transfer Failed" exception all the stranger.

Currently I've given up on wrapping the object in a using() statement and I dispose of them explicitly in a try/catch scope with logging so we can at least know when the operation fails.

Any ideas?

Thank you.

Edit: the version we are using is 3.0.5584.0

Applies to: Rebex SFTP

1 Answer

0 votes
by (144k points)
edited by

Hello, closing the stream retrieved from Sftp object's GetStream/GetUploadStream/GetDownloadStream methods actually results in sending a SSH_FXP_CLOSE request to the server, to which the server is supposed to reply with a SSH_FXP_STATUS response indicating success. However, it looks like it responded with an error in this case.

To make sure this is indeed the case, please use Sftp object's LogWriter property to create a communication log and see whether the error has been reported in response to the close request or not.

...