SBX - Search With Button

SBX - Forum Post Title

Corruption problem with Microsoft.Crm.Tools.EmailAgent.SystemState.Xml in CRM 2011

Microsoft Dynamics CRM Forum

-DC- asked a question on 25 Jun 2014 1:11 PM
My Badges

Question Status

Suggested Answer

I am looking for alternative fixes for my email router problems. I have followed this KB support.microsoft.com/.../954522 many times to fix issues when my email router service stops and can not be started. The KB says this is FIXED in CRM 2011 but I still have problems. Any suggestions to track down the cause or anyone else found alternative fixes?

Reply
-DC- responded on 25 Jun 2014 1:18 PM
My Badges

Log Name:      Application

Source:        MSCRMEmail

Date:          6/25/2014 12:00:36 PM

Event ID:      26234

Task Category: None

Level:         Error

Keywords:      Classic

User:          N/A

Computer:    

Description:

#26234 - The E-mail Router service could not process a provider work item using assembly: Microsoft.Crm.Tools.EmailProviders.dll and class: Microsoft.Crm.Tools.Email.Providers.SmtpPollingSendEmailProvider. System.IO.IOException: The process cannot access the file 'C:\Program Files\Microsoft CRM Email\Service\Microsoft.Crm.Tools.EmailAgent.SystemState.xml' because it is being used by another process.

  at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

  at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)

  at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)

  at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)

  at System.Xml.XmlDocument.Save(String filename)

  at Microsoft.Crm.Tools.Email.Providers.ConfigFileReader.Save()

  at Microsoft.Crm.Tools.Email.Providers.ConfigNodeReader.SetStringValue(String elementName, String setValue)

  at Microsoft.Crm.Tools.Email.Providers.CrmPollingSendEmailProvider.LogErrorToState(Exception exception)

  at Microsoft.Crm.Tools.Email.Providers.CrmPollingSendEmailProvider.HandleRetrieveNextMessageError(Exception exception)

  at Microsoft.Crm.Tools.Email.Providers.CrmPollingSendEmailProvider.Run()

  at Microsoft.Crm.Tools.Email.Agent.ServiceCore.ExecuteProviderWork(Object providerQueueRequestObject)

Event Xml:

<Event xmlns="schemas.microsoft.com/.../event">

 <System>

   <Provider Name="MSCRMEmail" />

   <EventID Qualifiers="0">26234</EventID>

   <Level>2</Level>

   <Task>0</Task>

   <Keywords>0x80000000000000</Keywords>

   <TimeCreated SystemTime="2014-06-25T19:00:36.000000000Z" />

   <EventRecordID>1253204</EventRecordID>

   <Channel>Application</Channel>

   <Computer></Computer>

   <Security />

 </System>

 <EventData>

   <Data>#26234 - The E-mail Router service could not process a provider work item using assembly: Microsoft.Crm.Tools.EmailProviders.dll and class: Microsoft.Crm.Tools.Email.Providers.SmtpPollingSendEmailProvider. System.IO.IOException: The process cannot access the file 'C:\Program Files\Microsoft CRM Email\Service\Microsoft.Crm.Tools.EmailAgent.SystemState.xml' because it is being used by another process.

  at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

  at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)

  at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)

  at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)

  at System.Xml.XmlDocument.Save(String filename)

  at Microsoft.Crm.Tools.Email.Providers.ConfigFileReader.Save()

  at Microsoft.Crm.Tools.Email.Providers.ConfigNodeReader.SetStringValue(String elementName, String setValue)

  at Microsoft.Crm.Tools.Email.Providers.CrmPollingSendEmailProvider.LogErrorToState(Exception exception)

  at Microsoft.Crm.Tools.Email.Providers.CrmPollingSendEmailProvider.HandleRetrieveNextMessageError(Exception exception)

  at Microsoft.Crm.Tools.Email.Providers.CrmPollingSendEmailProvider.Run()

  at Microsoft.Crm.Tools.Email.Agent.ServiceCore.ExecuteProviderWork(Object providerQueueRequestObject)</Data>

 </EventData>

</Event>

Reply
-DC- responded on 25 Jun 2014 1:20 PM
My Badges

Log Name:      Application

Source:        MSCRMEmail

Date:          6/25/2014 12:01:36 PM

Event ID:      61346

Task Category: None

Level:         Error

Keywords:      Classic

User:          N/A

Computer:  

Description:

#61346 - An error occurred while checking for outgoing e-mail messages to process for SMTP: server/orgname . System.IO.IOException: The process cannot access the file 'C:\Program Files\Microsoft CRM Email\Service\Microsoft.Crm.Tools.EmailAgent.SystemState.xml' because it is being used by another process.

  at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

  at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)

  at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)

  at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)

  at System.Xml.XmlDocument.Save(String filename)

  at Microsoft.Crm.Tools.Email.Providers.ConfigFileReader.Save()

  at Microsoft.Crm.Tools.Email.Providers.ConfigNodeReader.SetIntValue(String elementName, Int32 setValue)

  at Microsoft.Crm.Tools.Email.Providers.CrmPollingSendEmailProvider.RetrieveNextMessageInternal()

  at Microsoft.Crm.Tools.Email.Providers.CrmPollingSendEmailProvider.RetrieveNextMessage()

  at Microsoft.Crm.Tools.Email.Providers.CrmPollingSendEmailProvider.Run()

Event Xml:

<Event xmlns="schemas.microsoft.com/.../event">

 <System>

   <Provider Name="MSCRMEmail" />

   <EventID Qualifiers="0">61346</EventID>

   <Level>2</Level>

   <Task>0</Task>

   <Keywords>0x80000000000000</Keywords>

   <TimeCreated SystemTime="2014-06-25T19:01:36.000000000Z" />

   <EventRecordID>1253206</EventRecordID>

   <Channel>Application</Channel>

   <Computer></Computer>

   <Security />

 </System>

 <EventData>

   <Data>#61346 - An error occurred while checking for outgoing e-mail messages to process for SMTP: server/orgname. System.IO.IOException: The process cannot access the file 'C:\Program Files\Microsoft CRM Email\Service\Microsoft.Crm.Tools.EmailAgent.SystemState.xml' because it is being used by another process.

  at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

  at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)

  at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)

  at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)

  at System.Xml.XmlDocument.Save(String filename)

  at Microsoft.Crm.Tools.Email.Providers.ConfigFileReader.Save()

  at Microsoft.Crm.Tools.Email.Providers.ConfigNodeReader.SetIntValue(String elementName, Int32 setValue)

  at Microsoft.Crm.Tools.Email.Providers.CrmPollingSendEmailProvider.RetrieveNextMessageInternal()

  at Microsoft.Crm.Tools.Email.Providers.CrmPollingSendEmailProvider.RetrieveNextMessage()

  at Microsoft.Crm.Tools.Email.Providers.CrmPollingSendEmailProvider.Run()</Data>

 </EventData>

</Event>

Reply
Nina Peneva responded on 1 Jul 2014 4:29 AM
My Badges
Suggested Answer

Hi DC,

Thank you for using Microsoft Dynamics CRM Community. Do you have an Antivirus software running on the machine where the Email Router is installed?  If so, I'd first recommend you to ensure the locations where the XML file is located are excluded from antivirus scanning.

What is the number of users and Queues that have to be processed with the Router? If the Router is being heavily used, you might want to increase the pooling period and decrease the messages per circle so that the batches don’t overlap.

Please let me know if this helps and if you need additional information.

Nina Peneva

Support Engineer

Microsoft Dynamics CRM

Reply
-DC- responded on 1 Jul 2014 7:40 AM
My Badges

Thanks for the input, we are already excluding the service directory C:\Program Files\Microsoft CRM Email\Service. We have less than 70 mail enabled users, I don't think they are pushing out that much email. We are currently configured for Port 25, Connection timeout 300, Max messages per cycle 1000, polling period 60.

Based on this information what settings do you recommend?

Reply
Nina Peneva responded on 15 Jul 2014 4:44 AM
My Badges
Suggested Answer

Hi DC,

many thanks for this Information. The currently applied settings are suitable for the number of enabled users. I'd recommend you run Process Explorer or similar tool while reproducing the issue to check what is blocking that XML.

Please let me know if this helps and if you need additional information.

Nina Peneva

Support Engineer

Microsoft Dynamics CRM

Reply
-DC- responded on 15 Jul 2014 7:19 PM
My Badges

This problem is random and I don't know how to reproduce it as I don't know the cause / trigger of the corruption. We run for months with no issues and then will get reports of emails not sending and many times the fix is the steps provided in this KB. If there was some extra circular logging we could enable that would be useful. I am not sure how Proc Mon will help and also the time frame for the issue to happen would make this difficult.

I don't understand the comment about the XML being blocked? The XML gets corrupted and the service wont run/start and we follow the steps in the KB to rebuild it.

Any other suggestions? Your help is appreciated!

Reply
Jullian Valondo responded on 19 Feb 2018 7:36 AM

Hi DC, Are you able to resolve this issue?

Reply
-DC- responded on 1 Mar 2018 10:05 AM
My Badges

We never found an actual fix, however we have not had the issue in a long time, its possible MS fixed it with an update. I cant confirm that though unless someone finds a release note in a CU update somewhere...... (We had this issue on 2011 and 2013)

Reply
Nina Peneva responded on 1 Jul 2014 4:29 AM
My Badges
Suggested Answer

Hi DC,

Thank you for using Microsoft Dynamics CRM Community. Do you have an Antivirus software running on the machine where the Email Router is installed?  If so, I'd first recommend you to ensure the locations where the XML file is located are excluded from antivirus scanning.

What is the number of users and Queues that have to be processed with the Router? If the Router is being heavily used, you might want to increase the pooling period and decrease the messages per circle so that the batches don’t overlap.

Please let me know if this helps and if you need additional information.

Nina Peneva

Support Engineer

Microsoft Dynamics CRM

Reply
Nina Peneva responded on 15 Jul 2014 4:44 AM
My Badges
Suggested Answer

Hi DC,

many thanks for this Information. The currently applied settings are suitable for the number of enabled users. I'd recommend you run Process Explorer or similar tool while reproducing the issue to check what is blocking that XML.

Please let me know if this helps and if you need additional information.

Nina Peneva

Support Engineer

Microsoft Dynamics CRM

Reply

SBX - Two Col Forum

SBX - Migrated JS