[CSHARP-139] GetConnectionPool divide by zero exception Created: 22/Dec/10  Updated: 19/Oct/16  Resolved: 27/Dec/10

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

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

All


Backwards Compatibility: 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) {



 Comments   
Comment by Robert Stam [ 27/Dec/10 ]

Fixed in a slightly different way than suggested (by ensuring that secondaryConnectionPools is null when the Count is zero).

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