Files are uploaded with 0kb

Advertisement

cosb
Joined:
Posts:
10
Location:
Canada

Files are uploaded with 0kb

Hello,
We use the .NET assembly to upload files to a remote SFTP server via a custom C# app. The component has the version 1.16.0.16364 and it uses WinSCP 6.5.3. Recently, we had a case where a file was uploaded with 0KB. The component didn't report any errors in the app, so as far as our app was concerned the transfer was successful. Other files and lots of them were transferred properly.
Is there a way for our app to double-check the size of the uploaded file to make sure it was not 0kb and re-try the transfer if that's the case? The files are small, in this particular case the file had 1,722 bytes.
I also searched the forum and there have been other posts in the past about this very issue.
Here are 2 I found:
It seems to me that the server software was the culprit in these cases. We are going to explore that side as well but it belongs to third-party and I don't know exactly what they use and how responsive they are.
Could you please let me know if there is anything I can do in the app to detect a 0kb file upload and to re-try the transfer in this scenario? I want to make sure the transfers are foolproof.

Thank you so much!

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
42,528
Location:
Prague, Czechia

Re: Files are uploaded with 0kb

With SFTP protocol, when the upload seemingly succeeds without any error, but the uploaded file is empty, the most common issue is that the target file system is full.

Common OpenSSH SFTP server on Linux system fails to report any error in this case.

Reply with quote

cosb
Joined:
Posts:
10
Location:
Canada

Thank you for the reply. I don't think this is the case because other files were uploaded successfully after. One other detail is that they have almost 6,200 files in that folder. I am not sure if that has anything to do with anything.

After the upload is done, should I use EnumerateRemoteFiles to get back the uploaded file RemoteFileInfo and check its Length if I want to retry the upload operation in case the remote file has 0KB?

My code is very similar to this: https://winscp.net/eng/docs/library#csharp, I call PutFiles & Check. I don't know what Check does exactly.

Thank you again

Reply with quote

martin
Site Admin
martin avatar

You definitely can do that.
If you want to me investigate the zero upload, please post session log file. Name one file that uploaded correctly and one that did not.

Reply with quote

cosb

Thank you for confirmation. Unfortunately, it happens so rarely and I don't want to enable logging as it will produce a lot of logs until the issue occurs again.

Reply with quote

Advertisement

You can post new topics in this forum