Intermittent File Timestamp Permission Error

Advertisement

bcummins
Joined:
Posts:
10

Intermittent File Timestamp Permission Error

Hello,
WinSCP.exe file version: 5.21.1.12643 Product Version: 5.21.1.0
WinSCPnet.dll File version: 1.11.0.12643 Product Version: 5.21.1.0
Windows VB.NET application using 4.8 .NET framework.

We are having an intermittent issues when exporting 800 HTML files to a SFTP server. About 80% of the transfers complete without any error while roughly 20% of the transfers contain the errors listed below.
When we do get errors, then the errors usually report different file names that have the timestamp issue. There doesn't seem to be a pattern why some transfers complete without errors while others raise an error for what appears to be random files.

VB.NET code that creates the SFTP connection:
With sessOptions
    .Protocol = WinSCP.Protocol.Sftp
    .HostName = serverDetails.IPAddress.Trim
    .UserName = serverDetails.UserName.Trim
    .Password = serverDetails.Password.Trim
    .SshHostKeyFingerprint = serverDetails.SFTPKey.Trim
               
Dim transOptions As New TransferOptions
transOptions.TransferMode = TransferMode.Binary
transOptions.OverwriteMode = OverwriteMode.Overwrite
transOptions.PreserveTimestamp = True
transOptions.AddRawSettings("IgnorePermErrors", "1")
transOptions.ResumeSupport.State = TransferResumeSupportState.Off  
 
Dim transferResult As TransferOperationResult = sess.PutFiles(dmzPath, "/" + serverDetails.WebServerFolderPath, False, transOptions)
 
transferResult.Check()
Please help since this is causing issue with IIS caching the previous file loaded and not displaying the latest information to the public users on the web site. Thank you.
11/08/2022 09:16:51 PM
TRANSFER NAME: Results 2022GG Production ERROR: **Upload of file 'gen_results_2022_by_county_23.html' was successful, but error occurred while setting the permissions and/or timestamp.**

If the problem persists, turn off setting permissions or preserving timestamp. Alternatively you can turn on 'Ignore permission errors' option.
General failure (server should provide error description).
Error code: 4
Error message from server (en-US):

Common reasons for the Error code 4 are:
- Renaming a file to a name of already existing file.
- Creating a directory that already exists.
- Moving a remote file to a different filesystem (HDD).
- Uploading a file to a full filesystem (HDD).
- Exceeding a user disk quota.--WinSCPnet--WinSCP.SessionRemoteException: **Upload of file 'gen_results_2022_by_county_23.html' was successful, but error occurred while setting the permissions and/or timestamp.**

If the problem persists, turn off setting permissions or preserving timestamp. Alternatively you can turn on 'Ignore permission errors' option.
General failure (server should provide error description).
Error code: 4
Error message from server (en-US):

Common reasons for the Error code 4 are:
- Renaming a file to a name of already existing file.
- Creating a directory that already exists.
- Moving a remote file to a different filesystem (HDD).
- Uploading a file to a full filesystem (HDD).
- Exceeding a user disk quota.
at WinSCP.OperationResultBase.Check()
at MDCVRFileTransfer.CVRFileTransfer.TransferFiles(AemsWebServerDetailsDO& serverDetails, String dmzPath, String configPath) ||
TRANSFER NAME: Election Night 151 ERROR: **Upload of file 'gen_results_2022_by_county_6.html' was successful, but error occurred while setting the permissions and/or timestamp.**

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,454
Location:
Prague, Czechia

Re: Intermittent File Timestamp Permission Error

I do not see any error in the log.
If the problem is not caused by specific files and is intermittent, all you can do is:
  • Disable timestamp preserving:
    transOptions.PreserveTimestamp = False
    (I understand that this is probably not something you can do, due to the caching issue)
  • Retry the transfer
  • Get the server fixed.

Reply with quote

bcummins
Joined:
Posts:
10

Alternatively you can turn on 'Ignore permission errors' option

For now I want to just suppress this timestamp permission error. Can you please confirm these are the correct option settings for VB.NET?
Dim transOptions As New TransferOptions
transOptions.TransferMode = TransferMode.Binary
transOptions.OverwriteMode = OverwriteMode.Overwrite
transOptions.PreserveTimestamp = True
transOptions.AddRawSettings("IgnorePermErrors", "1")
transOptions.ResumeSupport.State = TransferResumeSupportState.Off  
 
Dim transferResult As TransferOperationResult = sess.PutFiles(dmzPath, "/" + serverDetails.WebServerFolderPath, False, transOptions)]

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: Alternatively you can turn on 'Ignore permission errors' option

When timestamp setting fails, in 99% cases, it's permissions problem. Hence the advice in the error message. But actually, you are not having permissions problem. So setting IgnorePermErrors won't make any difference.

Reply with quote

bcummins
Joined:
Posts:
10

Feature Request to Return a Collection of File Names from Failures Object

First, WinSCP is a great tool that has saved a lot of effort and time. Much appreciated!

I want to attempt to resend the files that have failed due to the message below.
**Upload of file 'gen_results_2022_by_county_5.html' was successful, but error occurred while setting the permissions and/or timestamp.**
Could you please add a list of string to the Failures object that contains a string of file names that returned from TransferOperationResult.Failures?
Dim transferResult As TransferOperationResult = Nothing
Try
    transferResult = sess.PutFiles(dmzPath, "/" + serverDetails.WebServerFolderPath, remove:=False, options:=transOptions)
    transferResult.Check()
 
Catch exw As SessionRemoteException
 
    If Not transferResult.Failures Is Nothing AndAlso transferResult.Failures.Count > 0 Then
        'Iterate through file list????
    End If
From the 805 HTML files we were sending to the public web servers, then only one or two files would throw this error message per batch. The problem is very intermittent on our production server and I cannot reproduce the error on the development server. Therefore, I am trying to just catch the error and try to resend the file[s] that throw this warning.

Thanks

Reply with quote

bcummins
Joined:
Posts:
10

Re: Intermittent File Timestamp Permission Error

Hi Martin,
I was able to get a log that contains the error. Hope it helps identify the issue.
I marked file as private but this contain information we don't want to public to view.
Thanks again.

Reply with quote

Advertisement

You can post new topics in this forum