Archived Forum Post

Index of archived forum posts

Question:

SFTP CloseHandle error code 4 after WriteFileBytes

Dec 17 '15 at 15:45

We have a situation where SFTP files are failing randomly throughout the day about 50% of the time on one of our SFTP connections. Not all connections, just one in particular, and it's seemingly random if it will pass/fail.

Here's the code that we are calling:

// Upload file
if (!sftp.WriteFileBytes(handle, binaryContent)) throw new Exception(sftp.LastErrorText);
// Close the file
if (!sftp.CloseHandle(handle)) throw new Exception(sftp.LastErrorText);

Chilkat is throwing an exception on the CloseHandle function, with error text shown below:

Exception: ChilkatLog:
  CloseHandle:
    DllDate: Oct 29 2015
    ChilkatVersion: 9.5.0.54
    UnlockPrefix: [REMOVED FOR PRIVACY]
    Username: [REMOVED FOR PRIVACY]:ASP.NET v4.0
    Architecture: Little Endian; 64-bit
    Language: .NET 4.5 / x64
    VerboseLogging: 0
    SshVersion: SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.7
    SftpVersion: 3
    handle: 00000000
    sftpCloseHandle:
      handle: 00000000
      Sent FXP_CLOSE
      sshReadMessage:
        mType: CHANNEL_DATA
      --sshReadMessage
      StatusResponseFromServer:
        Request: FXP_CLOSE
        InformationReceivedFromServer:
          StatusCode: 4
          StatusMessage: Failure
        --InformationReceivedFromServer
      --StatusResponseFromServer
      Received a failed status response.
    --sftpCloseHandle
    Failed.
  --CloseHandle
--ChilkatLog

Any insight would be appreciated!

Thanks, Greg


Answer

Does this server that fails have a really old version of SSH?


Answer

The technical resource on their end "cleaned up the folder", so I assume it was an issue stemming from a large amount of files in the FTP drop location.


Answer

Code 4 indicates an invalid message sent by server, and the write error is probably no disk space on the server, or either may be the server limits of data was exceeded.