pulumi-azure-native icon indicating copy to clipboard operation
pulumi-azure-native copied to clipboard

Retry "AnotherOperationInProgress" error messages

Open sam-cogan opened this issue 3 years ago • 13 comments

Affected feature

Currently if Azure generates a "AnotherOperationInProgress" error Pulumi will fail. This error is often caused by trying to access two sub-resources on a resource at the same time. A good example is creating multiple subnets on a virtual network. Pulumi will try and create them all that the same time, but Azure can only create them one at a time.

Adding a back-off and retry for the "AnotherOperationInProgress" error message would help workaround this problem

sam-cogan avatar Jun 07 '21 15:06 sam-cogan

@sam-cogan we'll take a look at this. In the meantime, if you create a dependsOn chain with these sub-resources, Pulumi won't try to create them all at the same time. See https://www.pulumi.com/docs/intro/concepts/resources/#dependson for details.

infin8x avatar Jun 08 '21 22:06 infin8x

@infin8x thanks, I have done that and it does indeed work around the issue.

sam-cogan avatar Jun 10 '21 13:06 sam-cogan

@sam-cogan we'll take a look at this. In the meantime, if you create a dependsOn chain with these sub-resources, Pulumi won't try to create them all at the same time. See https://www.pulumi.com/docs/intro/concepts/resources/#dependson for details.

While this workaround works perfectly the chaining of dependencies forces the developer to create the whole VNET and its Subnets in one module which is not optimal especially when trying to split code into different modules.

One example might be that the code for a specific module should create the Subnet in the VNET add the corresponding resources and configure firewall rules.

masashi-shib avatar Nov 09 '21 16:11 masashi-shib

@mikhailshilkov @infin8x I would also love to hear what is the impact of deleting the first subnet only (e.g. replacing its name) after the chaining is done.

e.g. Subnet 1 <--depends_on-- Subnet2 <--depends_on-- Subnet 3

What happens if in the case the Subnet 1 name has been changed? Does it create a havox delete basically on all resources that have an assignment in any of the subnets?

masashi-shib avatar Nov 10 '21 15:11 masashi-shib

Does it create a havox delete basically on all resources that have an assignment in any of the subnets?

I think the answer is yes, unfortunately. In that case you'd have to remove all the dependsOn annotations and run an update before trying to rename the first subnet. I realise it's not ideal and we should solve the original problem.

mikhailshilkov avatar Nov 11 '21 14:11 mikhailshilkov

Hi team, are there any plans to fix this? Terraform also had the same kind of race condition, but they already fixed that a while back.

deepak-goel avatar Feb 22 '22 12:02 deepak-goel

Hello Team, We are having exactly the same problem and we have to remove our factorization in order to chain the creation of the subnets in same vNet by the code :/

MatthewBettonMaif avatar Mar 22 '22 12:03 MatthewBettonMaif

I'm also running into this issue so a fix would be great, Thanks

Alan

DSTAlan avatar Apr 26 '22 15:04 DSTAlan

We just noticed this problem. If you need any help with this, I am more that willing!

RockyMM avatar Oct 28 '22 08:10 RockyMM

Any updates on this issue? It's really unfortunate to have this awkward limitation, especially when Pulumi is being deployed via CI/CD and I don't feel like chaning depends is a viable option.

olafurnielsen avatar Feb 13 '24 14:02 olafurnielsen

I'm getting it when trying to deploy a webapp. It deployed the rest of the stack ok, but keeps failing on this webapp, even though its the ONLY thing being deployed! I've waited 10-15 minutes from the first attempt.

its my first time using Pulumi so possibly I am doing something wrong:

// Create FunctionApp with Application Insights 
var functionApp = new WebApp(functionAppName, new WebAppArgs
{
    ResourceGroupName = resourceGroup.Name,
    ServerFarmId = appServicePlan.Id,
    SiteConfig = new SiteConfigArgs
    {
        AppSettings = new[]
        {
                new NameValuePairArgs { Name = "APPINSIGHTS_INSTRUMENTATIONKEY", Value = appInsights.InstrumentationKey },
                new NameValuePairArgs { Name = "WEBSITE_RUN_FROM_PACKAGE", Value = @"1" },
                new NameValuePairArgs { Name = "FUNCTIONS_WORKER_RUNTIME", Value = "dotnet" },
        },
        AlwaysOn = true,
    },
    Identity = new ManagedServiceIdentityArgs { Type = ManagedServiceIdentityType.SystemAssigned }
}, new CustomResourceOptions()
{
    DependsOn = new InputList<Pulumi.Resource>() { appInsights, imageStorageAccount, storageAccount, appServicePlan, blobContainer }
});

getting:

 Type                        Name         Status                  Info
 pulumi:pulumi:Stack         BandLab-dev  **failed**              1 error
  • └─ azure-native:web:WebApp functionApp creating failed 1 error Diagnostics: pulumi:pulumi:Stack (BandLab-dev): error: update failed

azure-native:web:WebApp (functionApp): error: autorest/azure: Service returned an error. Status= . Cannot modify this site because another operation is in progress. Details: Id: 763f49a6-6c9d-474b-8308-5b47e4df80fb, OperationName: Create, CreatedTime: 5/14/2024 9:08:39 PM, RequestId: 71a73020-cef3-475a-89ed-c7af7e177931, EntityType: 3

RDavis3000 avatar May 14 '24 21:05 RDavis3000

I'm getting it when trying to deploy a webapp. It deployed the rest of the stack ok, but keeps failing on this webapp, even though its the ONLY thing being deployed! I've waited 10-15 minutes from the first attempt.

its my first time using Pulumi so possibly I am doing something wrong:

// Create FunctionApp with Application Insights 
var functionApp = new WebApp(functionAppName, new WebAppArgs
{
    ResourceGroupName = resourceGroup.Name,
    ServerFarmId = appServicePlan.Id,
    SiteConfig = new SiteConfigArgs
    {
        AppSettings = new[]
        {
                new NameValuePairArgs { Name = "APPINSIGHTS_INSTRUMENTATIONKEY", Value = appInsights.InstrumentationKey },
                new NameValuePairArgs { Name = "WEBSITE_RUN_FROM_PACKAGE", Value = @"1" },
                new NameValuePairArgs { Name = "FUNCTIONS_WORKER_RUNTIME", Value = "dotnet" },
        },
        AlwaysOn = true,
    },
    Identity = new ManagedServiceIdentityArgs { Type = ManagedServiceIdentityType.SystemAssigned }
}, new CustomResourceOptions()
{
    DependsOn = new InputList<Pulumi.Resource>() { appInsights, imageStorageAccount, storageAccount, appServicePlan, blobContainer }
});

getting:

 Type                        Name         Status                  Info
 pulumi:pulumi:Stack         BandLab-dev  **failed**              1 error
  • └─ azure-native:web:WebApp functionApp creating failed 1 error Diagnostics: pulumi:pulumi:Stack (BandLab-dev): error: update failed

azure-native:web:WebApp (functionApp): error: autorest/azure: Service returned an error. Status= . Cannot modify this site because another operation is in progress. Details: Id: 763f49a6-6c9d-474b-8308-5b47e4df80fb, OperationName: Create, CreatedTime: 5/14/2024 9:08:39 PM, RequestId: 71a73020-cef3-475a-89ed-c7af7e177931, EntityType: 3

Is your SitePlan for this function app a Consumption plan? If so, alwaysOn wil break it.

j-fulbright avatar Jul 03 '24 15:07 j-fulbright

Still an issue.

smith558 avatar Aug 22 '24 11:08 smith558