The following error might appear randomly in the Sitecore logs:
ERROR Exception in alarm clock event subscriber. Exception: System.InvalidOperationException Message: Collection was modified; enumeration operation may not execute. Source: mscorlib at System.Collections.Hashtable.HashtableEnumerator.MoveNext() at Sitecore.Collections.SafeDictionary`2.d__7.MoveNext() at Sitecore.Pipelines.HealthMonitor.HealthMonitor.DumpRenderingsStatistics(PipelineArgs args) at (Object , Object[] ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Services.AlarmClock.Heartbeat_Beat(Object sender, EventArgs e)
The Sitecore HealthMonitor periodically enumerates the page rendering statistics collection to save the information into a file. The issue might occur if another thread tries to modify the collection concurrently, meaning, if a page is being rendered while the statistics are being saved.
The issue affects Sitecore XP 8.0.3 - 8.2.2, Sitecore XP 9.0.1, and later versions.
To resolve the issue, consider one of the following options:
Alternatively, to mitigate the issue, proceed with the following options:
<?xml version="1.0" encoding="utf-8" ?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <pipelines> <healthMonitor> <processor method="DumpRenderingsStatistics"> <patch:delete/> </processor> </healthMonitor> </pipelines> </sitecore> </configuration>
<!-- COLLECT RENDERING DATA Indicates if renderings statistics should be collected. Default value: true --> <setting name="Statistics.CollectRenderingData" value="false"/>Note: The values must be patched by creating a configuration patch in the \App_Config\Include\zzz folder.