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
Call this method, twice (via AJAX/xhr), with different parameters from the same page at nearly the same time.
Client logs show these requests occur within 1ms of eachother. Debugging shows that the operations occur concurrently.
The issue
The context appears to be shared between requests and causes some internal implementation errors (NPE, index out of range, etc) because both queries are running simultaneously.
If I use a mutex and lock around the query statement, the issue disappears entirely. The concurrent requests should be separate datacontexts, no?
Steps to reproduce
Add a scoped lifetime datacontext
In my controller it is injected in this way
In a dotnetcore 1.0, EF7 application, add dbcontext in Startup.cs like so:
(or, explicitly set to scoped lifetime)
Create a synchronous endpoint that executes a longer (~1s) query, and returns the result.
My controller has a method to run a long-running query and respond with the results as JSON. This calls .ToList() at the end of a LINQ query.
Specifically, my actual query is this:
Call this method, twice (via AJAX/xhr), with different parameters from the same page at nearly the same time.
Client logs show these requests occur within 1ms of eachother. Debugging shows that the operations occur concurrently.
The issue
The context appears to be shared between requests and causes some internal implementation errors (NPE, index out of range, etc) because both queries are running simultaneously.
If I use a mutex and lock around the query statement, the issue disappears entirely. The concurrent requests should be separate datacontexts, no?
The above code throws no exceptions at any time.
Further technical details
EF Core version: 1.0.0
Operating system: Windows 10
Visual Studio version: VS 2015
Other details about my project setup:
The text was updated successfully, but these errors were encountered: