-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 2.8.1
-
Component/s: Connectivity
-
None
-
(copied to CRM)
This is a simple code that I've used to reproduce the problem in my environment:
using System; using MongoDB.Driver; using System.Threading; namespace poolTest { class Program { // Credentials are deliberately incorrect static String uri = "mongodb://adminX:123@mubuntu:27017/test?authSource=admin&minPoolSize=10"; // static String uri = "mongodb://adminX:123@mubuntu:27017/test?authSource=admin"; static void Main(string[] args) { try { Console.WriteLine("Connecting...."); var client = new MongoClient(uri); Thread.Sleep(500000); } catch (Exception e) { Console.WriteLine("Exception caught {0}", e.Message); } } } }
If minPoolSize is not set, there is no issue. However, if it is set, then the driver just keeps opening new connections over and over again even though the authentication fails for each of those. The connections remain open until MongoClient instance is not destroyed.
This is a problem because a simple mistake in credentials can cause the application to exhaust all of the available connections on the server.
- is duplicated by
-
CSHARP-2029 High CPU utilization when specifying an unknown server in the connection string.
- Closed