-
Type: Bug
-
Resolution: Gone away
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.12.0
-
Component/s: API
-
None
-
Environment:TargetFramework: .NET 5
Project type: Microsoft.NET.Sdk.Worker
OS: Windows 10
MongoDB: Community Edition 4.4.3 2008R2Plus SLL (64 bit) - installed as Windows Service
Application info:
- TargetFramework: .NET 5
- Project type: Microsoft.NET.Sdk.Worker
For a few days now, my application sometimes hangs (deadlock?) after an await call to FindAsync of an IMongoCollection.
For example:
var testCursor = await testCollection.FindAsync(_ => true);
the same also happens for:
var testCursor = await testCollection.FindAsync(_ => true).ConfigureAwait(false);
Any line after this call is never reached.
The problem might happen because I use the API in a wrong way somewhere, but I wasn't able to recreate a minimal code example to reproduce the issue yet.
However, the deadlock always happens at this line: https://github.com/mongodb/mongo-csharp-driver/blob/51b48437814cd6d1f4882d1ca2387b1539c8f01f/src/MongoDB.Driver.Core/Core/ConnectionPools/ExclusiveConnectionPool.cs#L227
MaintainSizeAsync().ConfigureAwait(false);
I don't know if that line is not using await on purpose, but I figured it might be an oversight and I post what I found anyway to make sure it is at least checked by a developer who knows more about the code.
If I manage to create a minimal reproducible example, I will let you know.