projectkudu / kudu

Kudu is the engine behind git/hg deployments, WebJobs, and various other features in Azure Web Sites. It can also run outside of Azure.
Apache License 2.0
3.12k stars 652 forks source link

Access to the path '/home/site/locks/status.lock' is denied #3512

Closed carbage closed 2 months ago

carbage commented 3 months ago

For deployment issues, please provide us with the following information:

Repro steps.

Unknown - intermittent when using AzureWebApp@1 ADO task to deploy to Web App (Linux/Node 18 LTS) via ZipDeploy method

Project structures.

The log/error given by the failure.

Deployment in ADO seems to run until timeout; the Kudu deployment logs on the app itself show the following (full deployment log content):

2024-07-31T09:51:24.281Z,<web_app_name>.azurewebsites.net,,,2041e4bc-57fa-4e07-adc5-3bcb58e06c37,NODE,Linux,InProgress,Message,Writing artifact to /tmp/zipdeploy/87fc8881-fa50-4fde-a3e4-0ccf12e9f5c7.zip
2024-07-31T09:51:27.445Z,<web_app_name>.azurewebsites.net,,,2041e4bc-57fa-4e07-adc5-3bcb58e06c37,NODE,Linux,InProgress,Message,Start deployment in the background
2024-07-31T09:51:27.926Z,<web_app_name>.azurewebsites.net,,,2041e4bc-57fa-4e07-adc5-3bcb58e06c37,NODE,Linux,InProgress,Message,Creating temporary deployment - FetchDeploymentManager
2024-07-31T09:51:27.938Z,<web_app_name>.azurewebsites.net,,,2041e4bc-57fa-4e07-adc5-3bcb58e06c37,NODE,Linux,InProgress,Message,Creating temporary deployment
2024-07-31T09:51:28.108Z,<web_app_name>.azurewebsites.net,,,2041e4bc-57fa-4e07-adc5-3bcb58e06c37,NODE,Linux,InProgress,Message,Before sending BuildRequestReceived status to /api/updatedeploystatus
2024-07-31T09:51:28.264Z,<web_app_name>.azurewebsites.net,,,2041e4bc-57fa-4e07-adc5-3bcb58e06c37,NODE,Linux,InProgress,Message,Performing fetch based deployment
2024-07-31T09:51:29.447Z,<web_app_name>.azurewebsites.net,,,temp-11eb0b43,NODE,Linux,InProgress,Message,Fetching changes.
2024-07-31T09:51:29.481Z,<web_app_name>.azurewebsites.net,,,temp-11eb0b43,NODE,Linux,InProgress,Message,Cleaning up temp folders from previous zip deployments and extracting pushed zip file /tmp/zipdeploy/87fc8881-fa50-4fde-a3e4-0ccf12e9f5c7.zip (247.45 MB) to /tmp/zipdeploy/extracted
2024-07-31T09:51:29.498Z,<web_app_name>.azurewebsites.net,,,2041e4bc-57fa-4e07-adc5-3bcb58e06c37,NODE,Linux,InProgress,Message,Cleaning up temp folders from previous zip deployments and extracting pushed zip file /tmp/zipdeploy/87fc8881-fa50-4fde-a3e4-0ccf12e9f5c7.zip (247.45 MB) to /tmp/zipdeploy/extracted
2024-07-31T09:53:54.030Z,<web_app_name>.azurewebsites.net,,,2041e4bc-57fa-4e07-adc5-3bcb58e06c37,NODE,Linux,InProgress,Message,ChmodRecursive Process exited with total time taken in ms: 435
2024-07-31T09:53:56.085Z,<web_app_name>.azurewebsites.net,,,2041e4bc-57fa-4e07-adc5-3bcb58e06c37,NODE,Linux,InProgress,Message,Setting deployment invalidation to 120 mins
2024-07-31T09:53:56.121Z,<web_app_name>.azurewebsites.net,,,2041e4bc-57fa-4e07-adc5-3bcb58e06c37,NODE,Linux,InProgress,Message,Deployment timer started
2024-07-31T09:53:56.133Z,<web_app_name>.azurewebsites.net,,,2041e4bc-57fa-4e07-adc5-3bcb58e06c37,NODE,Linux,InProgress,Message,DeploymentManager.Deploy(id:2041e4bc-57fa-4e07-adc5-3bcb58e06c37)
2024-07-31T09:53:56.133Z,<web_app_name>.azurewebsites.net,,,2041e4bc-57fa-4e07-adc5-3bcb58e06c37,NODE,Linux,InProgress,Message,DeploymentManager.Deploy(id:2041e4bc-57fa-4e07-adc5-3bcb58e06c37)
2024-07-31T09:53:56.201Z,<web_app_name>.azurewebsites.net,,,2041e4bc-57fa-4e07-adc5-3bcb58e06c37,NODE,Linux,InProgress,Message,Collecting changeset information
2024-07-31T09:53:56.201Z,<web_app_name>.azurewebsites.net,,,2041e4bc-57fa-4e07-adc5-3bcb58e06c37,NODE,Linux,InProgress,Message,Collecting changeset information
2024-07-31T09:53:56.612Z,<web_app_name>.azurewebsites.net,,,2041e4bc-57fa-4e07-adc5-3bcb58e06c37,NODE,Linux,InProgress,Message,Error occurred type=error text=One or more errors occurred. (Access to the path '/home/site/locks/status.lock' is denied.) stackTrace=   at System.Threading.Tasks.Task.Wait(Int32   CancellationToken )
   at System.Threading.Tasks.Task.Wait()
   at Kudu.Core.Deployment.FetchDeploymentManager.<>c__DisplayClass16_1.<PerformBackgroundDeployment>b__3() in /tmp/KuduLite/Kudu.Core/Deployment/FetchDeploymentManager.cs:line 502
   at Kudu.Contracts.Infrastructure.LockExtensions.TryLockOperation(IOperationLock lockObj  Action operation  String operationName  TimeSpan timeout) in /tmp/KuduLite/Kudu.Contracts/Infrastructure/LockExtensions.cs:line 34
   at Kudu.Contracts.Infrastructure.LockExtensions.LockOperation(IOperationLock lockObj  Action operation  String operationName  TimeSpan timeout) in /tmp/KuduLite/Kudu.Contracts/Infrastructure/LockExtensions.cs:line 46
   at Kudu.Core.Deployment.FetchDeploymentManager.<>c__DisplayClass16_0.<PerformBackgroundDeployment>b__1() in /tmp/KuduLite/Kudu.Core/Deployment/FetchDeploymentManager.cs:line 481 innerText=Access to the path '/home/site/locks/status.lock' is denied. innerStackTrace=   at System.IO.RandomAccess.WriteAtOffset(SafeFileHandle   ReadOnlySpan`1   Int64 )
   at System.IO.Strategies.OSFileStreamStrategy.Write(ReadOnlySpan`1 )
   at System.IO.Strategies.BufferedFileStreamStrategy.Flush(Boolean )
   at System.IO.Strategies.BufferedFileStreamStrategy.Dispose(Boolean )
   at System.IO.Stream.Close()
   at Kudu.Core.Infrastructure.WindowsLockFile.Lock(String operationName) in /tmp/KuduLite/Kudu.Core/Infrastructure/WindowsLockFile.cs:line 192
   at Kudu.Contracts.Infrastructure.LockExtensions.TryLockOperation(IOperationLock lockObj  Action operation  String operationName  TimeSpan timeout) in /tmp/KuduLite/Kudu.Contracts/Infrastructure/LockExtensions.cs:line 41
   at Kudu.Contracts.Infrastructure.LockExtensions.LockOperation[T](IOperationLock lockObj  Func`1 operation  String operationName  TimeSpan timeout) in /tmp/KuduLite/Kudu.Contracts/Infrastructure/LockExtensions.cs:line 64
   at Kudu.Core.Deployment.FetchDeploymentManager.PerformDeployment(DeploymentInfoBase deploymentInfo  IDisposable tempDeployment  ChangeSet tempChangeSet  DeployStatusApiResult updateStatusObj) in /tmp/KuduLite/Kudu.Core/Deployment/FetchDeploymentManager.cs:line 285

Mention any other details that might be useful.

This issue is fixed briefly by removing the lock file


Thanks! We'll be in touch soon.

jvano commented 2 months ago

Hi

If the problem persists and is related to running it on Azure App Service, please open a support incident in Azure: https://learn.microsoft.com/en-us/azure/azure-portal/supportability/how-to-create-azure-support-request

This way we can better track and assist you on this case

Thanks,

Joaquin Vano Azure App Service