question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make concurrency check handle re-entrance

See original GitHub issue

Getting exception below when making Async calls.

Exception message:
A second operation started on this context before a previous operation completed. Any instance members are not guaranteed to be thread safe.

Stack trace:
   at Microsoft.EntityFrameworkCore.Internal.ConcurrencyDetector.EnterCriticalSection()
   at Microsoft.EntityFrameworkCore.Internal.ConcurrencyDetector.<EnterCriticalSectionAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   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.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Microsoft.AspNetCore.Identity.RoleManager`1.<RoleExistsAsync>d__34.MoveNext()
                    roleManager.CreateAsync(new ApplicationRole() { Name = role.Key, NormalizedName = role.Key.ToUpper(), System = true, Description = role.Value });
    }
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0",
"Microsoft.EntityFrameworkCore": "1.1.0",
"Microsoft.EntityFrameworkCore.Design": {
  "type": "build",
  "version": "1.1.0"
},

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
ajcvickerscommented, Jun 15, 2017

@divega @anpete Should we try to make this work? It’s not multiple threads, but rather one query that has calls that are (I assume) funcletized and themselves execute queries.

1reaction
ajcvickerscommented, Aug 12, 2019

Fixed in #17089

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make concurrency check handle re-entrance · Issue #7375
This is a common user error. No two sync or async operations can be in flight at the same time. All ...
Read more >
java - Is this the correct approach to achieve concurrency?
As I am not using any DB, I have created lock on the Account class itself using reentrant lock. Now when I am...
Read more >
Writing reentrant and threadsafe code
In single-threaded processes, only one flow of control exists. The code executed by these processes thus need not be reentrant or threadsafe.
Read more >
Coordinating Between Threads Using Reentrant Locks
The reason you'd do this is so that you can then make each method that needs a particular lock to manage its own...
Read more >
Sessions, Instancing, and Concurrency - WCF
A session is a correlation of all messages sent between two endpoints. Instancing refers to controlling the lifetime of user-defined service ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found