Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query: Except/Intersect methods in Ix-Async does not work well with buffering #8393

Closed
smitpatel opened this issue May 5, 2017 · 3 comments
Labels
closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. punted-for-2.0 type-bug

Comments

@smitpatel
Copy link
Contributor

smitpatel commented May 5, 2017

Line in the source code:
await Task.WhenAll((Task) moveNextTask, this.fillSetTask).ConfigureAwait(false);

Disabled tests
Except_nested
Intersect_nested

Stack trace

Stacktraces: 
(new) Test collection for Microsoft.EntityFrameworkCore.SqlServer.FunctionalTests.AsyncQuerySqlServerTest (1): Microsoft.EntityFrameworkCore.SqlServer.FunctionalTests.AsyncQuerySqlServerTest.Intersect_nested 
System.InvalidOperationException : There is already an open DataReader associated with this Command which must be closed first.
   at System.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__108_0(Task`1 result)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<ExecuteAsync>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable.AsyncEnumerator.<BufferlessMoveNext>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.<ExecuteAsync>d__6`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable.AsyncEnumerator.<MoveNext>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.<MoveNextCore>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Linq.AsyncEnumerable.AsyncIterator`1.<MoveNext>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Linq.AsyncEnumerable.IntersectAsyncIterator`1.<MoveNextCore>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Linq.AsyncEnumerable.AsyncIterator`1.<MoveNext>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Linq.AsyncEnumerable.IntersectAsyncIterator`1.<MoveNextCore>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Linq.AsyncEnumerable.AsyncIterator`1.<MoveNext>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.<MoveNextCore>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Linq.AsyncEnumerable.AsyncIterator`1.<MoveNext>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.<MoveNext>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Collections.Generic.AsyncEnumerableHelpers.<ToArrayWithLength>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Collections.Generic.AsyncEnumerableHelpers.<ToArray>d__0`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Specification.Tests.AsyncQueryTestBase`1.<AssertQuery>d__394`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Specification.Tests.AsyncQueryTestBase`1.<AssertQuery>d__388`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.EntityFrameworkCore.Specification.Tests.AsyncQueryTestBase`1.<Intersect_nested>d__348.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

Happens with MARS is false (buffering needed)

@smitpatel smitpatel changed the title Except/Intersect methods in Ix-Async does not work well with buffering. Except/Intersect methods in Ix-Async does not work well with buffering May 5, 2017
This was referenced May 5, 2017
@ajcvickers ajcvickers added this to the 2.0.0 milestone May 12, 2017
anpete added a commit to anpete/EntityFramework that referenced this issue May 15, 2017
- Fixes a race in async ShapedQuery execution.
- Optimizes ShapedQuery by pushing down shaper to inner enumerable.
- Removes IValueBufferCursor.Current - no longer used.
anpete added a commit that referenced this issue May 16, 2017
- Fixes a race in async ShapedQuery execution.
- Optimizes ShapedQuery by pushing down shaper to inner enumerable.
- Removes IValueBufferCursor.Current - no longer used.
anpete added a commit that referenced this issue May 16, 2017
- Fixes a race in async ShapedQuery execution.
- Optimizes ShapedQuery by pushing down shaper to inner enumerable.
- Removes IValueBufferCursor.Current - no longer used.
anpete added a commit that referenced this issue May 16, 2017
- Fixes a race in async ShapedQuery execution.
- Optimizes ShapedQuery by pushing down shaper to inner enumerable.
- Removes IValueBufferCursor.Current - no longer used.
anpete added a commit that referenced this issue May 16, 2017
- Fixes a race in async ShapedQuery execution.
- Optimizes ShapedQuery by pushing down shaper to inner enumerable.
- Removes IValueBufferCursor.Current - no longer used.
anpete added a commit that referenced this issue May 16, 2017
- Fixes a race in async ShapedQuery execution.
- Optimizes ShapedQuery by pushing down shaper to inner enumerable.
- Removes IValueBufferCursor.Current - no longer used.
anpete added a commit that referenced this issue May 16, 2017
- Fixes a race in async ShapedQuery execution.
- Optimizes ShapedQuery by pushing down shaper to inner enumerable.
- Removes IValueBufferCursor.Current - no longer used.
anpete added a commit that referenced this issue May 16, 2017
- Fixes a race in async ShapedQuery execution.
- Optimizes ShapedQuery by pushing down shaper to inner enumerable.
- Removes IValueBufferCursor.Current - no longer used.
anpete added a commit that referenced this issue May 16, 2017
- Fixes a race in async ShapedQuery execution.
- Optimizes ShapedQuery by pushing down shaper to inner enumerable.
- Removes IValueBufferCursor.Current - no longer used.
anpete added a commit that referenced this issue May 16, 2017
- Fixes a race in async ShapedQuery execution.
- Optimizes ShapedQuery by pushing down shaper to inner enumerable.
- Removes IValueBufferCursor.Current - no longer used.
@ajcvickers ajcvickers modified the milestones: 2.0.0, Backlog Jun 29, 2017
@ajcvickers ajcvickers changed the title Except/Intersect methods in Ix-Async does not work well with buffering Query: Except/Intersect methods in Ix-Async does not work well with buffering May 16, 2018
@divega divega removed this from the Backlog milestone Oct 20, 2018
@divega
Copy link
Contributor

divega commented Oct 20, 2018

Given we want to stop doing tricks to serialize async query enumeration (#10914), if in 3.0 we end still using System.Interactive.Async, we should ask it to stop using WhenAll in the regular query operators (it can still have a “special”, parallel version that implements it that way).

There is a good explanation at
https://github.com/dotnet/corefx/issues/32640#issuecomment-431572661.

Also related, issues with Union have been reported a few times although they have been hard to reproduce:
#12549.

Clearing up milestone to discuss tracking this for 3.0.

@ajcvickers ajcvickers added this to the 3.0.0 milestone Oct 22, 2018
@smitpatel
Copy link
Contributor Author

In 3.0, we are not going to do client eval so the only place where we need to call into linq operators over async enumerable would be InMemory (or any other provider which wants to evaluate something on client.
This issue is also related with #12048 if we need to get rid of IX-Async.
Further, we should be able to implement our own enumerator to deal with this.

@smitpatel smitpatel removed this from the 3.0.0 milestone Jun 5, 2019
@smitpatel smitpatel removed their assignment Jun 5, 2019
@smitpatel
Copy link
Contributor Author

We have removed IX-Async dependency. As noted above only InMemory would need to do client side operation but that would be done sync way so this issue won't arise. We don't need to do anything here.

@ajcvickers ajcvickers added the closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. label Mar 10, 2022
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. punted-for-2.0 type-bug
Projects
None yet
Development

No branches or pull requests

4 participants