[CSHARP-344] Timeout waiting for a MongoConnection. Created: 19/Oct/11  Updated: 02/Apr/15  Resolved: 05/Mar/12

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.2
Fix Version/s: 1.4

Type: Bug Priority: Major - P3
Reporter: ymind chan Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates CSHARP-406 Deadlock and TimeoutException when ac... Closed
Backwards Compatibility: Major Change

 Description   

Timeout waiting for a MongoConnection.

at MongoDB.Driver.Internal.MongoConnectionPool.AcquireConnection(MongoDatabase database)
at MongoDB.Driver.MongoServerInstance.AcquireConnection(MongoDatabase database)
at MongoDB.Driver.MongoServer.AcquireConnection(MongoDatabase database, Boolean slaveOk)
at MongoDB.Driver.MongoCursorEnumerator`1.AcquireConnection()
at MongoDB.Driver.MongoCursorEnumerator`1.GetFirst()
at MongoDB.Driver.MongoCursorEnumerator`1.MoveNext()



 Comments   
Comment by Robert Stam [ 05/Mar/12 ]

CSHARP-406 fixes the most likely cause for seeing this exception. Note that under heavy loads you might still see this exception.

Comment by Robert Stam [ 20/Feb/12 ]

As far as I know this was an issue with 1.2 only.

If anyone is seeing this issue with 1.3.1 AND it can't be explained by high load levels or eliminated by increasing the size of the connection pool let us know. Otherwise we plan to close this ticket.

Comment by Flavien [ 22/Dec/11 ]

I experienced the same issue in production. I have 2 frontend servers. They both work fine, and after a while, on one server, all the attempts to query MongoDB fails with that exception. The MongoDB server I use is running on MongoLab.com, but this is not an issue with them as one of the frontend server works perfectly fine (no latency). The other one continuously throws that exception until I restart the website. Also note that this never happened in a few months of production, and now happened twice in the last 2 days.

I never call Disconnect, and I cache the instances of MongoServer, MongoDatabase and MongoCollections (they are used across all requests).

Comment by Robert Stam [ 19/Oct/11 ]

Also, there is a bug in the 1.2 C# driver that can cause this exception if you call Disconnect.

Can you check whether you are calling Disconnect (or Reconnect) anywhere? If so, just remove the call to Disconnect. There is rarely a need to call Disconnect.

Comment by Robert Stam [ 19/Oct/11 ]

This could just be the result of the server being slow to respond to queries. Have you examined the server logs to see if there are any queries that are slow? If so, perhaps you need an index.

Can you provide any information on how to reproduce this?

Generated at Wed Feb 07 21:36:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.