部署包升级时VSTS Deploy Service Fabric应用程序任务超时

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了部署包升级时VSTS Deploy Service Fabric应用程序任务超时相关的知识,希望对你有一定的参考价值。

我们正在使用Deploy Service Fabric Application任务来自动将服务结构应用程序发布到集群。

我们遇到的第一个问题是PublishProfile中的ReplicaQuorumTimeoutSec选项。我们在发布日志中不断收到此消息:

ReplicaQuorumTimeoutSec is deprecated - use UpgradeReplicaSetCheckTimeoutSec

该版本将发布到群集,但不会升级。

我删除了该选项,不再出现上述错误,但升级仍然会失败。这是日志:

Register application type succeeded
Start upgrading application...
##[debug]System.TimeoutException: Operation timed out. ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80071BFF
##[debug]   at System.Fabric.Interop.NativeClient.IFabricApplicationManagementClient8.EndUpgradeApplication(IFabricAsyncOperationContext context)
##[debug]   at System.Fabric.Interop.Utility.<>c__DisplayClassa.<WrapNativeAsyncInvoke>b__9(IFabricAsyncOperationContext context)
##[debug]   at System.Fabric.Interop.AsyncCallOutAdapter2`1.Finish(IFabricAsyncOperationContext context, Boolean expectedCompletedSynchronously)
##[debug]   --- End of inner exception stack trace ---
##[debug]System.Management.Automation.PipelineStoppedException: The pipeline has been stopped.
##[debug]   at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
##[debug]   at System.Management.Automation.Cmdlet.ThrowTerminatingError(ErrorRecord errorRecord)
##[debug]   at Microsoft.ServiceFabric.Powershell.ApplicationCmdletBase.<>c__DisplayClass19.<UpgradeApplication>b__17(Exception ae)
##[debug]   at System.AggregateException.Handle(Func`2 predicate)
##[debug]   at Microsoft.ServiceFabric.Powershell.ApplicationCmdletBase.UpgradeApplication(ApplicationUpgradeDescription upgradeDescription)
##[debug]   at Microsoft.ServiceFabric.Powershell.StartApplicationUpgrade.ProcessRecord()
Current Upgrade State: RollingForwardInProgress
Current Upgrade State: RollingForwardCompleted
Upgrade completed successfully.

虽然日志表明更新成功,但实际上并不会发生更新。

最后,我尝试在PublishProfile中将超时从1秒更改为120秒。此版本完全失败,具有以下日志行:

Registering application type...
Register application type succeeded
Start upgrading application...
##[debug]System.Fabric.FabricException: aka.ms/upgrade-defaultservices ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80071BDF
##[debug]   at System.Fabric.Interop.NativeClient.IFabricApplicationManagementClient8.EndUpgradeApplication(IFabricAsyncOperationContext context)
##[debug]   at System.Fabric.Interop.Utility.<>c__DisplayClassa.<WrapNativeAsyncInvoke>b__9(IFabricAsyncOperationContext context)
##[debug]   at System.Fabric.Interop.AsyncCallOutAdapter2`1.Finish(IFabricAsyncOperationContext context, Boolean expectedCompletedSynchronously)
##[debug]   --- End of inner exception stack trace ---
##[debug]System.Management.Automation.PipelineStoppedException: The pipeline has been stopped.
##[debug]   at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
##[debug]   at System.Management.Automation.Cmdlet.ThrowTerminatingError(ErrorRecord errorRecord)
##[debug]   at Microsoft.ServiceFabric.Powershell.ApplicationCmdletBase.<>c__DisplayClass19.<UpgradeApplication>b__17(Exception ae)
##[debug]   at System.AggregateException.Handle(Func`2 predicate)
##[debug]   at Microsoft.ServiceFabric.Powershell.ApplicationCmdletBase.UpgradeApplication(ApplicationUpgradeDescription upgradeDescription)
##[debug]   at Microsoft.ServiceFabric.Powershell.StartApplicationUpgrade.ProcessRecord()
Getting application health:


ApplicationName                 : fabric:/NetScribe.Hangfire.ServiceFabric.Dev
AggregatedHealthState           : Ok
ServiceHealthStates             : 
                                  ServiceName           : fabric:/NetScribe.Hangfire.ServiceFabric.Dev/HangFire
                                  AggregatedHealthState : Ok

DeployedApplicationHealthStates : 
                                  ApplicationName       : fabric:/NetScribe.Hangfire.ServiceFabric.Dev
                                  NodeName              : _nswjobs_0
                                  AggregatedHealthState : Ok

HealthEvents                    : 
                                  SourceId              : System.CM
                                  Property              : State
                                  HealthState           : Ok
                                  SequenceNumber        : 2852
                                  SentAt                : 8/28/2018 5:10:27 PM
                                  ReceivedAt            : 8/28/2018 5:10:27 PM
                                  TTL                   : Infinite
                                  Description           : Application health policy has been updated.
                                  RemoveWhenExpired     : False
                                  IsExpired             : False
                                  Transitions           : Warning->Ok = 8/28/2018 5:05:08 PM, LastError = 1/1/0001 
                                  12:00:00 AM


Failed to start application upgrade. Error aka.ms/upgrade-defaultservices.
Could not start upgrade successfully. Unregistering application type 'NetScribe.Hangfire.ServiceFabricType' and version '2.0.0.18249.06'.
Unregister application type started (query application types for status).

这是PublishProfile的更新部分:

<UpgradeDeployment Mode="UnmonitoredAuto" Enabled="true">
    <Parameters UpgradeReplicaSetCheckTimeoutSec="120" TimeoutSec="120" Force="True" ForceRestart="True"/>
</UpgradeDeployment>

任何帮助实现这项工作将非常感激。

答案

根据我的经验,升级失败的原因有两个:

  • a)如果您更改有状态服务中的任何数据模型[在可靠的词典中]并且您的新数据模型与旧版本不兼容,[请参阅wcf数据合同版本控制],升级将失败。
  • b)如果您没有遵守“Runasync”中的“cancellationtoken”退出,则升级将超时。

如果不是上述2个问题,很可能是您在新版本中引入的新代码可能是问题所在。确保使用代码的生产副本创建本地开发群集,并尝试使用升级注入新代码并查看会发生什么。

以上是关于部署包升级时VSTS Deploy Service Fabric应用程序任务超时的主要内容,如果未能解决你的问题,请参考以下文章

如何在 VSTS DB Edition Deploy 中自定义 CREATE DATABASE 语句?

XL Deploy插件命令在升级时不执行

无法通过 VSTS 发布到安全的 Service Fabric 群集

升级后 Azure 服务结构持续部署和回滚选项

VSTS 发布自动部署完成失败警报

如何将 VSTS 上的构建配置为 FTP 部署