Answered by:
CrmAsync Service crashes and restarts every 5 mins

Question
-
Hello,
In current project I faced with situation that looks really strange for me and I have found nothing over the Intenet. Our Async Service crashes with following exception every 5 mins.
Host SRV-CRMBE-EN-02: failed while monitoring asynchronous operations queue. Exception: System.ArgumentException: An item with the same key has already been added.
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.System. Collections.Generic. ICollection<System. Collections.Generic. KeyValuePair<TKey,TValue>>. Add(KeyValuePair`2 keyValuePair)
at ReadAttributeCollectionFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )
at System.Runtime.Serialization.CollectionDataContract. ReadXmlValue( XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext .InternalDeserialize( XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext .InternalDeserialize( XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
at ReadEntityFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
at System.Runtime.Serialization.ClassDataContract. ReadXmlValue( XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext .InternalDeserialize( XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext .InternalDeserialize( XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
at ReadKeyValuePairOfstringanyTypeFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
at System.Runtime.Serialization.ClassDataContract. ReadXmlValue( XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext .InternalDeserialize( XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext .InternalDeserialize( XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
at ReadParameterCollectionFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )
at System.Runtime.Serialization.CollectionDataContract. ReadXmlValue( XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext .InternalDeserialize( XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext .InternalDeserialize( XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
at ReadAsyncOperationDataFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
at System.Runtime.Serialization.ClassDataContract. ReadXmlValue( XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext .InternalDeserialize( XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext .InternalDeserialize( XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
at ReadAsyncOperationDataFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
at System.Runtime.Serialization.ClassDataContract. ReadXmlValue( XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext .InternalDeserialize( XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext .InternalDeserialize( XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
at System.Runtime.Serialization.DataContractSerializer. InternalReadObject( XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.XmlObjectSerializer. ReadObjectHandleExceptions( XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.DataContractSerializer. ReadObject(XmlReader reader)
at Microsoft.Crm.Asynchronous.AsyncExecutionContext. DeserializeAsyncData( AsyncEvent asyncEvent)
at Microsoft.Crm.Asynchronous.AsyncExecutionContext..ctor( AsyncService asyncService, AsyncEvent asyncEvent)
at Microsoft.Crm.Asynchronous.EventOperation. InternalExecute(AsyncEvent asyncEvent)
at Microsoft.Crm.Asynchronous.AsyncOperationCommand.Execute( AsyncEvent asyncEvent)
at Microsoft.Crm.Asynchronous.QueueManager.PoolHandler. ProcessAsyncEvent(AsyncEvent asyncEvent)
at Microsoft.Crm.Asynchronous.QueueManager.PoolHandler. InvokeHandlerInPool(Object state)
at System.Threading.ExecutionContext.runTryCode( Object userData)
at System.Runtime.CompilerServices. RuntimeHelpers. ExecuteCodeWithGuaranteedClean up(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.Run( ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.QueueUserWorkItemCallback. System.Threading. IThreadPoolWorkItem. ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback. PerformWaitCallback()
Has anybody seen similar behavior? May be you can share some info regarding troubleshooting of similar issues with Async Service?
Freelance Developer for Dynamics CRM 4.0/2011
- Edited by Andrii ButenkoMVP, Moderator Wednesday, February 20, 2013 8:46 PM
Wednesday, February 20, 2013 8:45 PMModerator
Answers
-
Hello,
For those who could face the same issue I will publish solution here - http://msdn.microsoft.com/en-us/library/tcbchxcb%28v=VS.80%29.aspx
- Marked as answer by Andrii ButenkoMVP, Moderator Monday, February 25, 2013 9:09 AM
Monday, February 25, 2013 9:09 AMModerator
All replies
-
Never happened to me, but I will check for pending workflows and cancel them (if possible), looks like that the async service try to recover the pending jobs and crash, creating a loop.
Wednesday, February 20, 2013 8:53 PM -
I would take a CRM Server Profiler trace to see if it gives you more info.Thursday, February 21, 2013 9:46 PM
-
Hello,
For those who could face the same issue I will publish solution here - http://msdn.microsoft.com/en-us/library/tcbchxcb%28v=VS.80%29.aspx
- Marked as answer by Andrii ButenkoMVP, Moderator Monday, February 25, 2013 9:09 AM
Monday, February 25, 2013 9:09 AMModerator -
enabling RCSI fixed it?Monday, February 25, 2013 5:57 PM
-
Hello,
For those who could face the same issue I will publish solution here - http://msdn.microsoft.com/en-us/library/tcbchxcb%28v=VS.80%29.aspx
Hi Andriji,
We are also facing the similar issue in live environment like async service is restarting for every 5 minutes.
Could you please let us know the exact solution to this issue?
Thanks in advance
Thursday, December 18, 2014 9:14 AM