-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
RC2 Deadlock problem with CountAsync() that does not happen with Count() #5481
Comments
@maumar for the nav prop null expansion, should this be null ref'ing? |
@iberodev Does the deadlock occur if you remove the Includes. BTW, the Includes are not needed if you are just doing a Count. |
@anpete Yes, if I remove the Includes the deadlock still happens when using |
Ping @maumar |
@iberodev No luck repro'ing at my end yet. Are you able to create a self-contained repro for this? |
@anpete it looks like a bug in the way we protect from null refs during optional navigation rewrites. Both CargoReport and AltCargoReport are optional, so only the first one will be translated to sql. The second one is done on the client. We do apply our null compensation logic, but we produce something like this:
|
filed #5613 to track this |
@anpete I have created a sample repository with a project showing the deadlock issue.
PS: The mapping for the navigation property does not seem quite right but this is how it was in our project. Tomorrow I will have a look at it but I don't think it has anything to do with the deadlock issue. |
@iberodev Thanks! |
Looks like the deadlock is in IX-Async|GroupJoin. Fix is to write our own version. Note for triage, to hit this the query needs to hit two optional nav props. |
Clearing up milestone again, so we can discuss with @anpete in triage. |
Triage: we will attempt to fix this for RTM. |
…ot happen with Count() - Replace IX-Async GroupJoin with async/await impl.
…ot happen with Count() - Replace IX-Async GroupJoin with async/await impl.
I have found an inconsistency when querying a
query.CountAsync();
. It does not throw any error nor displays any error on console, it simply gets into a deadlock state (the application is still up but the next line of code does not get to execute)The problem does not happen when using the same query to count the items in a synchronous way:
query.Count();
Scenario:
I have an entity that has 2 optional references to another entity
Now I try to count the items in database with a simple query and the synchronous call works fine but the asynchronous call gets the code onto a deadlock state:
I know the problem has to do with CargoReport and AltCargoReport being a null reference because If I had something like this:
I would get the following exception when executing the
count2
line:So a few things here:
.Count()
works well but the.CountAsync()
doesn't? shouldn't be both consistent?.CountAsync()
call at least throw a null reference exception if that's the case for the deadlock?Thanks guys.
The text was updated successfully, but these errors were encountered: