IStatefulServiceReplica.Open 上的错误 - 已添加具有相同密钥的项目

Posted

技术标签:

【中文标题】IStatefulServiceReplica.Open 上的错误 - 已添加具有相同密钥的项目【英文标题】:Error on IStatefulServiceReplica.Open - An item with the same key has already been added 【发布时间】:2018-10-03 17:30:11 【问题描述】:

我们有一个包含两个分区的参与者服务。所有空闲的辅助副本都处于警告状态,并带有来自 Service Fabric Explorer 的以下消息:

Unhealthy event: SourceId='System.RA', Property='ReplicaOpenStatus', HealthState='Warning', ConsiderWarningAsError=false.
Replica had multiple failures during open on _cp_3. API call: IStatefulServiceReplica.Open(); Error = System.ArgumentException (-2147024809)
An item with the same key has already been added.
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
   at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
   at System.Type.GetType(String typeName, Boolean throwOnError)
   at System.Type.GetType(String typeName, Boolean throwOnError)
   at System.Fabric.BackupRestore.BackupRestoreManagerFactory.GetBackupRestoreManager(IBackupRestoreReplica replica)
   at System.Fabric.BackupRestore.BackupRestoreManagerFactory.GetBackupRestoreManager(IBackupRestoreReplica replica)
   at System.Fabric.KeyValueStoreReplica..ctor(String storeName, LocalStoreSettings localStoreSettings, ReplicatorSettings replicatorSettings, KeyValueStoreReplicaSettings kvsSettings)
   at System.Fabric.KeyValueStoreReplica..ctor(String storeName, LocalStoreSettings localStoreSettings, ReplicatorSettings replicatorSettings, KeyValueStoreReplicaSettings kvsSettings)
   at Microsoft.ServiceFabric.Actors.Runtime.KvsActorStateProvider.OnCreateAndInitializeReplica(StatefulServiceInitializationParameters initParams, Action`1 copyHandler, Action`1 replicationHandler, Func`2 onDataLossHandler, Func`2 restoreCompletedHandler)
   at Microsoft.ServiceFabric.Actors.Runtime.KvsActorStateProviderBase.Microsoft.ServiceFabric.Data.IStateProviderReplica.Initialize(StatefulServiceInitializationParameters initializationParameters)
   at System.Fabric.ServiceFactoryBroker.CreateHelper[TFactory,TReturnValue](IntPtr nativeServiceType, IntPtr nativeServiceName, UInt32 initializationDataLength, IntPtr nativeInitializationData, Guid partitionId, Func`3 creationFunc, Action`2 initializationFunc, ServiceInitializationParameters initializationParameters)
For more information see: http://aka.ms/sfhealth

我们在从一个分区移动到两个分区时第一次遇到这个错误。停用节点并删除数据是一个临时修复,因为问题在下一次部署中再次出现。

该问题导致 Service Fabric 不断尝试启动服务,该服务一直处于“启动、终止、重复”的永久循环中。

我了解处于 IdleSecondary 状态的副本意味着它当前正在从其他节点获取数据以提升为 ActiveSecondary。在我看来,这个问题与从演员的其他节点获取数据有关。

是什么导致了这个问题,我以后该如何预防?

【问题讨论】:

【参考方案1】:

不支持 ActorService 的重新分区。如果要增加分区数,需要先删除服务再重新创建。

当您说:“从一个分区移动到两个分区。”时,您能否分享有关您实际执行的 Service Fabric 操作的详细信息?

【讨论】:

以上是关于IStatefulServiceReplica.Open 上的错误 - 已添加具有相同密钥的项目的主要内容,如果未能解决你的问题,请参考以下文章