Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
0.9
-
None
-
None
-
All
-
Fully Compatible
Description
The GetConnectionPool function in MongoServer.cs in the driver will attempt to divide by zero is no slaves are available and SlaveOk is set on the connection.
The secondary connection pool should be bypassed if there are no servers in it (e.g. all except one node in a replicaset is available).
Adding an additional check should revert all reads to the master if no slaves are available:
if (slaveOk && secondaryConnectionPools != null && secondaryConnectionPools.Count > 0) {