-
Type: Bug
-
Resolution: Done
-
Priority: Critical - P2
-
Affects Version/s: 1.8.1
-
Component/s: None
-
None
-
Fully Compatible
System.InvalidOperationException: Sequence contains more than one matching element
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at MongoDB.Driver.MongoServer.get_Primary()
MongoServerInstance.Primary is calling _serverProxy.Instances.SingleOrDefault(x => x.IsPrimary);
In our case proxy is ReplicaSetMongoServerProxy
When method ProcessConnectedInstanceStateChange is called, the previously disconnected instance can come with Primary set to true.
In this case the previous Primary instance may not see its flag unset by ProcessConnectedPrimaryStateChange method before a call to MongoServerInstance.Primary is done => Exception.
- duplicates
-
CSHARP-724 MongoServer.IsPrimary Would Error When a Failover Occured Until the Old Primary Came Back Online
- Closed