Details
-
Bug
-
Resolution: Done
-
Major - P3
-
1.3.1
-
None
Description
The following code sample causes a deadlock and then a TimeoutException with message "Timeout waiting for a MongoConnection.":
|
sample.cs |
using System.Threading.Tasks;
|
using MongoDB.Bson;
|
using MongoDB.Driver;
|
|
|
namespace TestApp1
|
{
|
class Program
|
{
|
static void Main(string[] args)
|
{
|
var srv = MongoServer.Create("mongodb://localhost/?maxpoolsize=1&waitqueuetimeoutms=5000");
|
var coll = srv["log"]["log"];
|
Parallel.For(0, 2, i => coll.Insert(new BsonDocument("fld1", "val1")));
|
}
|
}
|
}
|
The core of problem is: "maxpoolsize" parameter (small value), number of iterations (more than "maxpoolsize") and the parallel execution.
I can reproduce this bug only with small values of "maxpoolsize", but I marked this bug as "Major" because I looked at the driver code and I think this deadlock can occur for any value of "maxpoolsize".
Attachments
Issue Links
- is duplicated by
-
CSHARP-333 1.2 Crashes our App Domain with a Exception: System.TimeoutException: Timeout waiting for a MongoConnection
-
- Closed
-
-
CSHARP-343 .Net Web App via C# driver reports connection problems
-
- Closed
-
-
CSHARP-344 Timeout waiting for a MongoConnection.
-
- Closed
-
- is related to
-
CSHARP-340 Unable to connect when Primary switches
-
- Closed
-
-
CSHARP-323 Timeout in background state management thread crashes application domain
-
- Closed
-