Exception: Collection was modified; enumeration operation may not execute...
Posted: Thu 12 Jul 2018 17:01
Hi. We are experiencing problems with MySQL provider for EF Core. It seems to be some issues with concurrency. We are using dotconnect for MySQL in ASP.NET Core application. Sometimes query execution throws an exception and results in a failed web request.
Also, we have made a simple console application which reproduces described errors by emulating load of our API application. The link: https://github.com/Dyavolik/devart-bug. Along with demo console application, you will find DB dump there.
This problem does a huge impact on our development process, so we ask for any information about the status of the problem.
Exception logs:
1:
2:
Also, we have made a simple console application which reproduces described errors by emulating load of our API application. The link: https://github.com/Dyavolik/devart-bug. Along with demo console application, you will find DB dump there.
This problem does a huge impact on our development process, so we ask for any information about the status of the problem.
Exception logs:
1:
Code: Select all
System.AggregateException: One or more errors occurred. (Collection was modified; enumeration operation may not execute.) ---> System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at ??.(IList`1 )
at ??.????(? )
at ??.VisitBinary(BinaryExpression )
at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
at ??.VisitBinary(BinaryExpression )
at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
at ??.????(SelectExpression )
at ??.????(SelectExpression )
at System.Linq.Expressions.ExpressionVisitor.VisitAndConvert[T](T node, String callerName)
at ??.CreateDefault(SelectExpression )
at Microsoft.EntityFrameworkCore.Query.Internal.ShaperCommandContext.<NotifyReaderCreated>b__14_0(FactoryAndReader s)
at Microsoft.EntityFrameworkCore.Internal.NonCapturingLazyInitializer.EnsureInitialized[TParam,TValue](TValue& target, TParam param, Func`2 valueFactory)
at Microsoft.EntityFrameworkCore.Query.Internal.ShaperCommandContext.NotifyReaderCreated(DbDataReader dataReader)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.BufferlessMoveNext(DbContext _, Boolean buffer, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.MoveNext(CancellationToken cancellationToken)
at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.MoveNextCore(CancellationToken cancellationToken)
at System.Linq.AsyncEnumerable.AsyncIterator`1.MoveNext(CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext(CancellationToken cancellationToken)
at System.Linq.AsyncEnumerable.Aggregate_[TSource,TAccumulate,TResult](IAsyncEnumerable`1 source, TAccumulate seed, Func`3 accumulator, Func`2 resultSelector, CancellationToken cancellationToken)
at BugReplication.Program.<>c.<<Main>b__1_1>d.MoveNext() in C:\Users\Vlad\source\repos\s\davart-bug\DevartBug\Program.cs:line 23
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.WaitAllCore(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.WaitAll(Task[] tasks)
at BugReplication.Program.Main(String[] args) in C:\Users\Vlad\source\repos\s\davart-bug\DevartBug\Program.cs:line 28
---> (Inner Exception #0) System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at ??.(IList`1 )
at ??.????(? )
at ??.VisitBinary(BinaryExpression )
at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
at ??.VisitBinary(BinaryExpression )
at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
at ??.????(SelectExpression )
at ??.????(SelectExpression )
at System.Linq.Expressions.ExpressionVisitor.VisitAndConvert[T](T node, String callerName)
at ??.CreateDefault(SelectExpression )
at Microsoft.EntityFrameworkCore.Query.Internal.ShaperCommandContext.<NotifyReaderCreated>b__14_0(FactoryAndReader s)
at Microsoft.EntityFrameworkCore.Internal.NonCapturingLazyInitializer.EnsureInitialized[TParam,TValue](TValue& target, TParam param, Func`2 valueFactory)
at Microsoft.EntityFrameworkCore.Query.Internal.ShaperCommandContext.NotifyReaderCreated(DbDataReader dataReader)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.BufferlessMoveNext(DbContext _, Boolean buffer, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.MoveNext(CancellationToken cancellationToken)
at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.MoveNextCore(CancellationToken cancellationToken)
at System.Linq.AsyncEnumerable.AsyncIterator`1.MoveNext(CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext(CancellationToken cancellationToken)
at System.Linq.AsyncEnumerable.Aggregate_[TSource,TAccumulate,TResult](IAsyncEnumerable`1 source, TAccumulate seed, Func`3 accumulator, Func`2 resultSelector, CancellationToken cancellationToken)
at BugReplication.Program.<>c.<<Main>b__1_1>d.MoveNext() in C:\Users\Vlad\source\repos\s\davart-bug\DevartBug\Program.cs:line 23<---
Code: Select all
System.AggregateException: One or more errors occurred. (Collection was modified; enumeration operation may not execute.) (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3) (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3) (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3) (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3) (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3) (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3) (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3) (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3) (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3) (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3) (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3) ---> System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at ??.(IList`1 )
at ??.????(? )
at ??.VisitBinary(BinaryExpression )
at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
at ??.VisitBinary(BinaryExpression )
at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
at ??.????(SelectExpression )
at ??.????(SelectExpression )
at System.Linq.Expressions.ExpressionVisitor.VisitAndConvert[T](T node, String callerName)
at ??.CreateDefault(SelectExpression )
at Microsoft.EntityFrameworkCore.Query.Internal.ShaperCommandContext.GetRelationalCommand(IReadOnlyDictionary`2 parameters)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.BufferlessMoveNext(DbContext _, Boolean buffer, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.MoveNext(CancellationToken cancellationToken)
at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.MoveNextCore(CancellationToken cancellationToken)
at System.Linq.AsyncEnumerable.AsyncIterator`1.MoveNext(CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext(CancellationToken cancellationToken)
at System.Linq.AsyncEnumerable.Aggregate_[TSource,TAccumulate,TResult](IAsyncEnumerable`1 source, TAccumulate seed, Func`3 accumulator, Func`2 resultSelector, CancellationToken cancellationToken)
at BugReplication.Program.<>c.<<Main>b__1_1>d.MoveNext() in C:\Users\Vlad\source\repos\s\davart-bug\DevartBug\Program.cs:line 23
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.WaitAllCore(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.WaitAll(Task[] tasks)
at BugReplication.Program.Main(String[] args) in C:\Users\Vlad\source\repos\s\davart-bug\DevartBug\Program.cs:line 28
---> (Inner Exception #0) System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at ??.(IList`1 )
at ??.????(? )
at ??.VisitBinary(BinaryExpression )
at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
at ??.VisitBinary(BinaryExpression )
at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor visitor)
at ??.????(SelectExpression )
at ??.????(SelectExpression )
at System.Linq.Expressions.ExpressionVisitor.VisitAndConvert[T](T node, String callerName)
at ??.CreateDefault(SelectExpression )
at Microsoft.EntityFrameworkCore.Query.Internal.ShaperCommandContext.GetRelationalCommand(IReadOnlyDictionary`2 parameters)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.BufferlessMoveNext(DbContext _, Boolean buffer, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.MoveNext(CancellationToken cancellationToken)
at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.MoveNextCore(CancellationToken cancellationToken)
at System.Linq.AsyncEnumerable.AsyncIterator`1.MoveNext(CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext(CancellationToken cancellationToken)
at System.Linq.AsyncEnumerable.Aggregate_[TSource,TAccumulate,TResult](IAsyncEnumerable`1 source, TAccumulate seed, Func`3 accumulator, Func`2 resultSelector, CancellationToken cancellationToken)
at BugReplication.Program.<>c.<<Main>b__1_1>d.MoveNext() in C:\Users\Vlad\source\repos\s\davart-bug\DevartBug\Program.cs:line 23<---
---> (Inner Exception #1) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3<---
---> (Inner Exception #2) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3<---
---> (Inner Exception #3) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3<---
---> (Inner Exception #4) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3<---
---> (Inner Exception #5) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3<---
---> (Inner Exception #6) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3<---
---> (Inner Exception #7) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3<---
---> (Inner Exception #8) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3<---
---> (Inner Exception #9) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3<---
---> (Inner Exception #10) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3<---
---> (Inner Exception #11) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ) = '2018-06-25 00:00:00')' at line 3<---