-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
None
-
Affects Version/s: 2.4.4
-
Component/s: Connectivity
-
None
-
Environment:.Net Full, Windows Server 2012
So I have a long running Windows Service that is performing a few dozen tasks each of which read/write to two different mongo servers (one being a 3 member replica set and the other being a single member replica set).
The MongoClients for all processes are being handled by a Singleton. This has been up and running for a year+ with no issues using the following code to acquire a MongoClient.
```
_client = new MongoClient(connstring);
```
Simple Enough.
Now we wanted to try and get some analytics for the queries and changed it to the following;
```
Action<string, DateTime, TimeSpan, bool> _trackIt = null;
var mongoUrl = new MongoUrl(connstring);
var mongoClientSettings = MongoClientSettings.FromUrl(mongoUrl);
mongoClientSettings.ClusterConfigurator = clusterConfigurator =>
{
if (_trackIt != null)
};
_client = new MongoClient(mongoClientSettings);
```
Now with the Example above the Action used for tracking is in fact null as this process isn't collecting any analytics on performance.
I would expect this to perform the same but after a couple of hours of running the tasks without an issue we start getting the following error and have to constantly re-start the service.
```
System.TimeoutException: A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = WritableServerSelector, LatencyLimitingServerSelector
}. Client view of cluster state is { ClusterId : "8536", ConnectionMode : "Automatic", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "
{ ClusterId : 8536, EndPoint : "Unspecified/someserver.in.datacenter.com:27017" }", EndPoint: "Unspecified/someserver.in.datacenter.com:27017", State: "Disconnected", Type: "Unknown" }] }.
at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description)
at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedHelper.HandleCompletedTask(Task completedTask)
at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChanged(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Clusters.Cluster.SelectServer(IServerSelector selector, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Bindings.WritableServerBinding.GetWriteChannelSource(CancellationToken cancellationToken)
at MongoDB.Driver.Core.Operations.FindAndModifyOperationBase`1.Execute(IWriteBinding binding, CancellationToken cancellationToken)
at MongoDB.Driver.OperationExecutor.ExecuteWriteOperation[TResult](IWriteBinding binding, IWriteOperation`1 operation, CancellationToken cancellationToken)
at MongoDB.Driver.MongoCollectionImpl`1.ExecuteWriteOperation[TResult](IWriteOperation`1 operation, CancellationToken cancellationToken)
at MongoDB.Driver.MongoCollectionImpl`1.FindOneAndUpdate[TProjection](FilterDefinition`1 filter, UpdateDefinition`1 update, FindOneAndUpdateOptions`2 options, CancellationToken cancellationToken)
```
We get the error for both servers each erroring out independently. No changes are made to the connection string between the failing and error-less execution path.