You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
InvalidOperationException Collection was modified when inserting from multiple threads
Bug could already be solved by 2536
Code to Reproduce
Sorry - the code is on a machine with no internet access
to reproduce do multiple serializations of the same type, from multiple threads using the same BsonMapper instance
Thread A enters GetEntityMapper and does not find the mapper.
Thread A calls BuildAddEntityMapper, and goes past, adding an entity mapper to the _entities dictionary but not yet updating the List Members of the mapper
thread B enters GetEntityMapper.
Thread B finds a mapper and returns, but this mapper is still being populated by thread A
Thread B Iterates over the List Members - while thread A adds to the same list
Thread B throws the exception below
Screenshots/Stacktrace
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.List1.Enumerator.MoveNextRare() at System.Linq.Enumerable.WhereListIterator1.MoveNext()
at LiteDB.BsonMapper.SerializeObject(Type type, Object obj, Int32 depth)
at LiteDB.BsonMapper.Serialize(Type type, Object obj, Int32 depth)
at LiteDB.BsonMapper.ToDocument(Type type, Object entity)
at LiteDB.BsonMapper.ToDocument[T](T entity)
at LiteDB.LiteCollection1.<GetBsonDocs>d__52.MoveNext() at LiteDB.Engine.LiteEngine.<>c__DisplayClass7_0.<Insert>b__0(TransactionService transaction) at LiteDB.Engine.LiteEngine.AutoTransaction[T](Func2 fn)
Additional context
this issue was probably introduced by this fix : 2493
so it might be short lived - I did not see any other similar issues reported - but you guys probably know better.
I am still waiting for the release of the fix 2536 to validate if it is fixed this current issue.
The text was updated successfully, but these errors were encountered:
Version
LiteDB 5.0.21 / .NET 472
Describe the bug
InvalidOperationException Collection was modified when inserting from multiple threads
Bug could already be solved by 2536
Code to Reproduce
Sorry - the code is on a machine with no internet access
to reproduce do multiple serializations of the same type, from multiple threads using the same BsonMapper instance
Thread A enters GetEntityMapper and does not find the mapper.
Thread A calls BuildAddEntityMapper, and goes past, adding an entity mapper to the _entities dictionary but not yet updating the List Members of the mapper
thread B enters GetEntityMapper.
Thread B finds a mapper and returns, but this mapper is still being populated by thread A
Thread B Iterates over the List Members - while thread A adds to the same list
Thread B throws the exception below
Screenshots/Stacktrace
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.List
1.Enumerator.MoveNextRare() at System.Linq.Enumerable.WhereListIterator
1.MoveNext()at LiteDB.BsonMapper.SerializeObject(Type type, Object obj, Int32 depth)
at LiteDB.BsonMapper.Serialize(Type type, Object obj, Int32 depth)
at LiteDB.BsonMapper.ToDocument(Type type, Object entity)
at LiteDB.BsonMapper.ToDocument[T](T entity)
at LiteDB.LiteCollection
1.<GetBsonDocs>d__52.MoveNext() at LiteDB.Engine.LiteEngine.<>c__DisplayClass7_0.<Insert>b__0(TransactionService transaction) at LiteDB.Engine.LiteEngine.AutoTransaction[T](Func
2 fn)Additional context
this issue was probably introduced by this fix : 2493
so it might be short lived - I did not see any other similar issues reported - but you guys probably know better.
I am still waiting for the release of the fix 2536 to validate if it is fixed this current issue.
The text was updated successfully, but these errors were encountered: