-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 1.7
-
Component/s: None
-
None
-
Environment:Replica set
Two mongod instances (one with two votes)
Under the following conditions the client is unable to automatically re-connect to a secondary without restarting IIS:
- The primary is down
- The client is connected to the secondary
- The secondary goes down
- The secondary comes back up
In an attempt to recover from this I tried .Reconnect(), but the client is still unable to reconnect to the server.
Dug into the code a bit and it appears that as soon as the secondary starts up again and the client notices and apparently erroneously removes the secondary from the list of instances. Because the primary is down and the primary is now the only remaining instance the client knows about it will not reconnect.
If I alter IsValidInstance in ReplicaSetMongoServerProxy to skip the 'instance.InstanceType != MongoServerInstanceType.ReplicaSetMember' check it appears to behave as expected.
I've tried lots of different connection strings and they do not appear to alter the behavior. Here in an example if it is helpful: mongodb://user:password@localhost,tools/DatabaseName?safe=true&readPreference=primaryPreferred
I don't understand what should be going on well enough to submit a patch - sorry.
Thanks,
-Michael