0 votes
by (120 points)
edited

Hi,

We are observing intermittent errors when calling GetFile(remotPath, localPath)...

The stacktrace is shown below...

This does not happen all the time (seems that the occurrence may be related to large files / specific server type).

The application is multi-threaded but at the time the error is thrown, no other threads are executing (or have been executing prior to the running thread being invoked).

Any help greatly appreciated...

Stacktrace:

System.ObjectDisposedException: Safe handle has been closed
   at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
   at System.StubHelpers.StubHelpers.SafeHandleAddRef(SafeHandle pHandle, Boolean& success)
   at System.Security.Cryptography.CapiNative.UnsafeNativeMethods.CryptDecrypt(SafeCapiKeyHandle hKey, SafeCapiHashHandle hHash, Boolean Final, Int32 dwFlags, IntPtr pbData, Int32& pdwDataLen)
   at System.Security.Cryptography.CapiSymmetricAlgorithm.RawDecryptBlocks(Byte[] buffer, Int32 offset, Int32 count)
   at System.Security.Cryptography.CapiSymmetricAlgorithm.DecryptBlocks(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[] outputBuffer, Int32 outputOffset)
   at System.Security.Cryptography.CapiSymmetricAlgorithm.TransformBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[] outputBuffer, Int32 outputOffset)
   at wWGvS.AIchsYZ.AcUJKJ(Byte[] )
   at Rebex.Net.SshSession.AePCoRZ(Byte[]& )
   at Rebex.Net.SshSession.cDtmAOZ(cMbfbTZ , Object[] )
   at Rebex.Net.SshChannel.cDtmAOZ(Boolean , cMbfbTZ , Object[] )
   at Rebex.Net.SshChannel.Receive(Byte[] buffer, Int32 offset, Int32 count)
   at wWGvS.AzRMspZ.BMJzdYZ(Byte[] , Int32 , Int32 )
   at wWGvS.APnbEo.BXQTfX(Int32 )
   at wWGvS.APnbEo.CFLiXJ(BBdsJfZ& )
   at wWGvS.APnbEo.CFLiXJ(UInt32 )
   at wWGvS.APnbEo.BdgSrC(UInt32 )
   at Rebex.Net.Sftp.CipxfYZ(AYPecc , String , Stream , Int64 , Int64 )
   at Rebex.Net.Sftp.CipxfYZ(FileMode , AYPecc , String , String , Int64 , Int64 , Int64 )
   at Rebex.Net.Sftp.GetFile(String remotePath, String localPath)
Applies to: Rebex SFTP

1 Answer

0 votes
by (134k points)
edited

This looks like the instance of System.Security.Cryptography.ICryptoTransform used for decryption of SSH session data was disposed.

From the stack trace, it looks like you are using Rebex SFTP v2.0.4086.0 or earlier. Would it be possible to try the latest release, Rebex SFTP 2012 R1? There were actually some changes in how instances of ICryptoTransform are disposed, so it's quite possible the new version already solves this (or at least produces a different error).

by (120 points)
edited

Brilliant!

Thanks for the quick response...

I will try the latest version and see if we observe the same issue again...

by (134k points)
edited

Thanks! If you do observer the issue with the new version as well, please post an updated stack trace and a log produced using Sftp object's LogWriter property (as described at http://www.rebex.net/kb/logging.aspx).

...