microsoft / service-fabric

Service Fabric is a distributed systems platform for packaging, deploying, and managing stateless and stateful distributed applications and containers at large scale.
https://docs.microsoft.com/en-us/azure/service-fabric/
MIT License
3.02k stars 399 forks source link

ARM Deploy Application Upgrade Success returns failure #1140

Open mwasplund opened 3 years ago

mwasplund commented 3 years ago

Service Fabric Runtime Version: 7.2.432.9590

Environment: Azure

Description: When I use the ARM Template for creating an Application (https://docs.microsoft.com/en-us/azure/templates/microsoft.servicefabric/clusters/applications) the first deploy works as expected. However when I deploy an updated version of my code using the same flow the service fabric application is upgraded, but the Azure Deployment thinks the step failed with a 'Conflict'

Expected: I would expect the Deployment to return success

OS Windows


Assignees: /cc @microsoft/service-fabric-triage

mwasplund commented 3 years ago

Looking through the SF event logs everything looks normal and I get a final ApplicationUpgradeCompleted event.

Here is the details of the error coming in through Azure Resource Manager: { "content": { "id": "/subscriptions/REMOVED/providers/Microsoft.ServiceFabric/locations/westus2/operations/REMOVED", "name": "REMOVED", "status": "Failed", "startTime": "2021-01-27T19:11:20.9061225Z", "endTime": "2021-01-27T19:23:39.4327597Z", "percentComplete": 0, "error": { "code": "ClusterChildResourceOperationFailed", "message": "Resource operation failed. Operation: CreateOrUpdate. Error details: {\r\n \"Details\": {\r\n \"ClassName\": \"System.ArgumentException\",\r\n \"Message\": \"Invalid flags: 0\",\r\n \"Data\": null,\r\n \"InnerException\": {\r\n \"ClassName\": \"System.ArgumentException\",\r\n \"Message\": \"Value does not fall within the expected range.\",\r\n \"Data\": null,\r\n \"InnerException\": null,\r\n \"HelpURL\": null,\r\n \"StackTraceString\": \" at System.Fabric.Interop.NativeClient.IFabricApplicationManagementClient10.EndUpdateApplicationUpgrade(IFabricAsyncOperationContext context)\r\n at System.Fabric.Interop.Utility.<>c__DisplayClass22_0.b0(IFabricAsyncOperationContext context)\r\n at System.Fabric.Interop.AsyncCallOutAdapter2`1.Finish(IFabricAsyncOperationContext context, Boolean expectedCompletedSynchronously)\",\r\n \"RemoteStackTraceString\": null,\r\n \"RemoteStackIndex\": 0,\r\n \"ExceptionMethod\": \"8\nEndUpdateApplicationUpgrade\nSystem.Fabric, Version=7.0.0.0, Culture=neutral, PublicKeyToken=REMOVED\nSystem.Fabric.Interop.NativeClient+IFabricApplicationManagementClient10\nVoid EndUpdateApplicationUpgrade(IFabricAsyncOperationContext)\",\r\n \"HResult\": -2147024809,\r\n \"Source\": \"System.Fabric\",\r\n \"WatsonBuckets\": null,\r\n \"ParamName\": null\r\n },\r\n \"HelpURL\": null,\r\n \"StackTraceString\": \" at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Fabric.UpgradeService.ApplicationClient.d9.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Fabric.UpgradeService.ApplicationCommandProcessor.d__9.MoveNext()\",\r\n \"RemoteStackTraceString\": null,\r\n \"RemoteStackIndex\": 0,\r\n \"ExceptionMethod\": \"8\nThrow\nmscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\nSystem.Runtime.ExceptionServices.ExceptionDispatchInfo\nVoid Throw()\",\r\n \"HResult\": -2147024809,\r\n \"Source\": \"mscorlib\",\r\n \"WatsonBuckets\": null,\r\n \"ParamName\": null\r\n }\r\n}", "details": [] } } }

mwasplund commented 3 years ago

Template: { "apiVersion": "2020-03-01", "type": "Microsoft.ServiceFabric/clusters/applications", "name": "[concat(variables('clusterName'), '/', parameters('applicationName'))]", "location": "[parameters('computeLocation')]", "dependsOn": [ "[concat('Microsoft.ServiceFabric/clusters/', variables('clusterName'), '/applicationTypes/', parameters('applicationTypeName'), '/versions/', variables('applicationTypeVersion'))]" ], "properties": { "typeName": "[parameters('applicationTypeName')]", "typeVersion": "[variables('applicationTypeVersion')]", "parameters": "[parameters('applicationParameters')]" } }

mwasplund commented 3 years ago

FYI the issue here was that the upgradePolicy property was not set (even though it says it is optional). When I updated my ARM template to set the default upgradePolicy object values it now works... Can we update the docs to indicate that this property is required.