WinSCP removes/deletes files from SFTP server after transfer

Advertisement

Alex121224
Joined:
Posts:
3
Location:
Ukraine

WinSCP removes/deletes files from SFTP server after transfer

Hi All,
I have set up a daily upload of some files on the SFTP server using WinSCP. I have noticed that during every second-time upload, WinSCP partially overwrites and partially deletes some CSV files on the SFTP server.

For example, two days ago, all files were uploaded on the SFTP, yesterday I have noticed the missed ones, and today all files are present again. Those three automated uploads were successfully completed, but every second time I witness missing files.

Here are some logs uploading of two files. One of them was successfully uploaded, but WinSCP deleted the second.

23:45:13.878 [sshd-SftpSubsystem-thread-1] INFO  c.e.d.e.s.s.s.f.S3BufferedFileWriter - *****_aesd**_**************/52.24.156.220:59507: Uploading part #1 of gg4l-ftp1/685860/schools.csv
23:45:14.041 [task-34208] INFO  c.e.d.e.s.s.s.f.S3BufferedFileWriter - Upload complete: dz-stage-ftp/****-ftp1/685860/schools.csv by user: *****_aesd**_**************/52.24.156.220:59507
--------------------------------------------------------------------------
23:45:14.683 [sshd-SftpSubsystem-thread-1] INFO  c.e.d.e.s.s.s.f.S3BufferedFileWriter - *****_aesd**_**************/52.24.156.220:59507: Uploading part #1 of ****-ftp1/685860/sections.csv
23:45:14.836 [sshd-SftpSubsystem-thread-1] INFO  c.e.d.e.s.s.s3.S3FileSystemProvider - User with id and username: 97 *****_aesd**_**************, [b]trying to delete file by path[/b]: ****-ftp1/685860/sections.csv
23:45:14.905 [task-34210] INFO  c.e.d.e.s.s.s.f.S3BufferedFileWriter - Upload complete: dz-stage-ftp/****-ftp1/685860/sections.csv by user: *****_aesd**_**************/52.24.156.220:59507

My question is:
what is the root cause of the issue?
What do I need to do to get this fixed?

Thanks in advance,
Alex

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
36,051
Location:
Prague, Czechia

Re: WinSCP removes/deletes files from SFTP server after transfer

Please post a WinSCP session log file for the problem. Describe what did happen incorrectly in that particular session and what did you expect instead to happen.

Reply with quote

Alex121224
Joined:
Posts:
3
Location:
Ukraine

WinSCP removes/deletes files from SFTP server after transfer

Hi
My apologies for such a late response. I was out of the office.
I have attached two files with logs:
first_upload.log with successful upload
second_upload.log upload where removing CSV files took place

Here is the bat script:
   "put C:\Users\alexl\Documents\alexlike23\academicSessions.csv /" ^
   "put C:\Users\alexl\Documents\alexlike23\classes.csv /" ^
   "put C:\Users\alexl\Documents\alexlike23\orgs.csv /" ^
   "put C:\Users\alexl\Documents\alexlike23\courses.csv /" ^
   "put C:\Users\alexl\Documents\alexlike23\users.csv /" ^
   "put C:\Users\alexl\Documents\alexlike23\enrollments.csv /" ^
   "put C:\Users\alexl\Documents\alexlike23\demographics.csv /" ^
   "ls"
I have analyzed in details two files and noticed some difference:
. 2021-05-04 17:14:35.610 File exists: users.csv;-;179358;2021-05-05T14:11:48.000Z;3;"" [0];"" [0];rw-rw-rw-;1
> 2021-05-04 17:14:36.603 Type: SSH_FXP_REMOVE, Size: 19, Number: 7181
< 2021-05-04 17:14:36.802 Type: SSH_FXP_STATUS, Size: 17, Number: 7181
I still have this problem.
My questions the same:
What is the root cause of the issue?
What do I need to do to get this fixed?

Thanks,
Alex
  • second_upload.log (28.23 KB, Private file)

Reply with quote

Alex121224
Joined:
Posts:
3
Location:
Ukraine

WinSCP removes/deletes files from SFTP server after transfer

As for your specified questions:

"Describe what did happen incorrectly in that particular session" – during every second-time upload, WinSCP partially overwrites (which is ok) and partially deletes (which is very bad) some CSV files on the SFTP server. In the second_upload.log file, we can see removing CSV files, which is unacceptable;
"What did you expect instead to happen" – we expect to upload all files as it has shown the first_upload.log file.

I hope it covers your questions.

Thanks,
Aleks

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
36,051
Location:
Prague, Czechia

Re: WinSCP removes/deletes files from SFTP server after transfer

Well, I hoped that you would name the exact files that have the problem. "Some files" is not specific enough.
But after investigating the log files, I'll assume that the files that had the problem were users.csv and enrollments.csv.
The difference is that for the second run, the files already existed on the server. Both files are over 100 KB, what is the threshold for WinSCP to upload the files using a temporary name. When the upload finished, WinSCP deleted the existing files and renamed the temporary files to the target names. From the log file, I can see that WinsCP did that correctly. If it instead resulted in lost files, I'm 99% sure that it's a bug in the server.
You can try to prevent the bug from occuring by disabling the use of the temporary files:
 "put -resumesupport=off C:\Users\alexl\Documents\alexlike23\users.csv /" ^
See https://winscp.net/eng/docs/scriptcommand_put#resumesupport
Though you better the get the server fixed.

Reply with quote

Advertisement

You can post new topics in this forum