Error indexing queue items - Collection was modified; enumeration operation may not execute.
Hi all.
Using Umbraco 8.16.0, Lucene.Net 3.0.3 and Examine 1.2.2.
First off. Everytime we recycled the app pool, the indexes went empty. Then we used <add key="Umbraco.Core.MainDom.Lock" value="SqlMainDomLock" /> in the Web.config <appSettings> and that seems to fix that issue.
The issue we got at hand, is that from time to time we get an Error indexing queue items with Collection was modified; enumeration operation may not execute. This lead to Cannot index queue items, the index is currently locked and then emptied.
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Enumerator.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at CustomCode.Components.IndexCreatorComponent.CreateContentCombinedField(IDictionary`2 valueSetValues, String culture) in D:\CustomCode\Components\IndexCreatorComponent.cs:line 944
at CustomCode.Components.IndexCreatorComponent.IndexProviderTransformingIndexValues(Object sender, IndexingItemEventArgs e) in D:\CustomCode\Components\IndexCreatorComponent.cs:line 840
at Examine.Providers.BaseIndexProvider.OnTransformingIndexValues(IndexingItemEventArgs e) in D:\a\1\s\src\Examine\Providers\BaseIndexProvider.cs:line 146
at Umbraco.Examine.UmbracoExamineIndex.OnTransformingIndexValues(IndexingItemEventArgs e) in D:\a\1\s\src\Umbraco.Examine\UmbracoExamineIndex.cs:line 177
at Examine.LuceneEngine.Providers.LuceneIndex.ProcessIndexQueueItem(IndexOperation op, IndexWriter writer) in D:\a\1\s\src\Examine\LuceneEngine\Providers\LuceneIndex.cs:line 1331
at Examine.LuceneEngine.Providers.LuceneIndex.ProcessQueueItem(IndexOperation item, IndexWriter writer) in D:\a\1\s\src\Examine\LuceneEngine\Providers\LuceneIndex.cs:line 1133
at Examine.LuceneEngine.Providers.LuceneIndex.ForceProcessQueueItems(Boolean block) in D:\a\1\s\src\Examine\LuceneEngine\Providers\LuceneIndex.cs:line 981
We use some custom code to update the index through the api for TransformingIndexValues(object sender, IndexingItemEventArgs e), but are gettin the Collection was modified error in our foreach of the e.ValueSet.Values. But we do only modify the e.ValueSet.Values with e.ValueSet.TryAdd("key", "value") after the foreach is done and all data is returned.
So the question is what we can do to make sure the collection aint modified and there after locked and emptied?
We are experiencing the same issue, every now and then we get the same error from our environments:
[Error] Error indexing queue items
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Enumerator.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Umbraco.Examine.UmbracoExamineIndex.OnDocumentWriting(DocumentWritingEventArgs docArgs) in D:\a\1\s\src\Umbraco.Examine\UmbracoExamineIndex.cs:line 142
at Examine.LuceneEngine.Providers.LuceneIndex.AddDocument(Document doc, ValueSet valueSet, IndexWriter writer) in D:\a\1\s\src\Examine\LuceneEngine\Providers\LuceneIndex.cs:line 794
at Examine.LuceneEngine.Providers.LuceneIndex.ProcessIndexQueueItem(IndexOperation op, IndexWriter writer) in D:\a\1\s\src\Examine\LuceneEngine\Providers\LuceneIndex.cs:line 1334
at Examine.LuceneEngine.Providers.LuceneIndex.ProcessQueueItem(IndexOperation item, IndexWriter writer) in D:\a\1\s\src\Examine\LuceneEngine\Providers\LuceneIndex.cs:line 1133
at Examine.LuceneEngine.Providers.LuceneIndex.ForceProcessQueueItems(Boolean block) in D:\a\1\s\src\Examine\LuceneEngine\Providers\LuceneIndex.cs:line 981
Error indexing queue items - Collection was modified; enumeration operation may not execute.
Hi all.
Using Umbraco 8.16.0, Lucene.Net 3.0.3 and Examine 1.2.2.
First off. Everytime we recycled the app pool, the indexes went empty. Then we used
<add key="Umbraco.Core.MainDom.Lock" value="SqlMainDomLock" />
in the Web.config<appSettings>
and that seems to fix that issue.The issue we got at hand, is that from time to time we get an
Error indexing queue items
withCollection was modified; enumeration operation may not execute.
This lead toCannot index queue items, the index is currently locked
and then emptied.We use some custom code to update the index through the api for
TransformingIndexValues(object sender, IndexingItemEventArgs e)
, but are gettin theCollection was modified
error in our foreach of thee.ValueSet.Values
. But we do only modify thee.ValueSet.Values
withe.ValueSet.TryAdd("key", "value")
after the foreach is done and all data is returned.So the question is what we can do to make sure the collection aint modified and there after locked and emptied?
We are experiencing the same issue, every now and then we get the same error from our environments:
Our version of Umbraco is 8.16.0
Hi Adriano.
We reduced the errors of these types by making the e.ValueSet.Values to a list like this:
I guess its because .ToList() makes a copy of the object.
However we do still get these errors from time to time, but not very often.
is working on a reply...