[CSHARP-1619] Time outs when tryng to connect to mongoDb linux Created: 04/Apr/16  Updated: 12/Dec/18  Resolved: 18/Aug/16

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

Type: Bug Priority: Blocker - P1
Reporter: shai bar Assignee: Craig Wilson
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

linux server



 Description   

we are trying to connect to the mongo server using a .net driver

and getting this message ""The wait queue for acquiring a connection to server 172.168.12.100:27017 is full."

the exception
at MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.AcquireConnectionHelper.CheckingOutConnection() in D:\jenkins\workspace\mongo-csharp-driver-2.2.x-build\src\MongoDB.Driver.Core\Core\ConnectionPools\ExclusiveConnectionPool.cs:line 411
at MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.<AcquireConnectionAsync>d__35.MoveNext() in D:\jenkins\workspace\mongo-csharp-driver-2.2.x-build\src\MongoDB.Driver.Core\Core\ConnectionPools\ExclusiveConnectionPool.cs:line 177
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at MongoDB.Driver.Core.Servers.ClusterableServer.<GetChannelAsync>d__40.MoveNext() in D:\jenkins\workspace\mongo-csharp-driver-2.2.x-build\src\MongoDB.Driver.Core\Core\Servers\ClusterableServer.cs:line 226
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at MongoDB.Driver.Core.Operations.BulkMixedWriteOperation.<ExecuteAsync>d__39.MoveNext() in D:\jenkins\workspace\mongo-csharp-driver-2.2.x-build\src\MongoDB.Driver.Core\Core\Operations\BulkMixedWriteOperation.cs:line 204
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at MongoDB.Driver.OperationExecutor.<ExecuteWriteOperationAsync>d__3`1.MoveNext() in D:\jenkins\workspace\mongo-csharp-driver-2.2.x-build\src\MongoDB.Driver\OperationExecutor.cs:line 46
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at MongoDB.Driver.MongoCollectionImpl`1.<ExecuteWriteOperationAsync>d__61`1.MoveNext() in D:\jenkins\workspace\mongo-csharp-driver-2.2.x-build\src\MongoDB.Driver\MongoCollectionImpl.cs:line 759
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at MongoDB.Driver.MongoCollectionImpl`1.<BulkWriteAsync>d__22.MoveNext() in D:\jenkins\workspace\mongo-csharp-driver-2.2.x-build\src\MongoDB.Driver\MongoCollectionImpl.cs:line 179
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at W6BigDataStore.W6MongoDBProvider`1.<InsertDataAsync>d__9.MoveNext() in C:\Workspace\MultiTenant2\SO\Infrastructure\source\Audit\W6BigDataStore\W6BigDataStore\W6MongoDBProvider.cs:line 84



 Comments   
Comment by Robin Munn [ 06/Sep/16 ]

Andrew Stewart is correct; this is a bug in Mono 3.12. I added a comment to CSHARP-1144 that goes into more detail, but basically, the Mono implementation of SemaphoreSlim.Wait() has a race condition. It creates a timer, then goes into an infinite loop where it first checks if the timer has exceeded the specified wait time, and returns false if the timeout has been exceeded. Then and only then does it check if the semaphore is "full". So if you call SemaphoreSlim.Wait(0), and it just so happens that at least 1 millisecond passes between when the Wait() function sets up that timer and when it checks the timer for the first time, Wait() will return false without ever checking if the queue has free slots. And if Wait() returns false, Mongo quite reasonably assumes that it's a real "the queue is full" condition, and throws a MongoWaitQueueFullException.

In Mono 4.0, they switched to using the Microsoft reference implementation for many classes, including SemaphoreSlim. And since the Microsoft reference implementation doesn't suffer from this particular race-condition bug, you'll see no more spurious MongoWaitQueueFullExceptions being thrown if you just upgrade to Mono 4.0.

If upgrading Mono is not an option for you, though, I'm not sure what the best solution is.

Comment by Andrew Stewart [ 07/Jul/16 ]

Hmm, I looked a bit more into this, and it seems in this case it's just running into a bug with mono. With Mono v3.12.2, the following code reliably crashes in a few minutes with n=10, or a few seconds with n=100. While I didn't leave it running for hours, It never seems to crash running on Windows or with Mono v4.4.0, so they must have changed something in future versions which fixed it.

using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
 
namespace ConsoleApplication1 {
   class Program {
       private static void Main(string[] args) {
           var queue = new SemaphoreSlim(1250, 1250);
           int n = args.Length == 0 ? 10 : int.Parse(args[0]);
           while (true) {
               Task.WaitAll(Enumerable.Range(0, n).Select(_ => Task.Run(() => {
                   var entered = false;
                   try {
                       entered = queue.Wait(0);
                       if (!entered) {
                           throw new Exception("Wait failed");
                       }
                   } finally {
                       if (entered) {
                           queue.Release();
                       }
                   }
               })).ToArray());
           }
       }
   }
}

Comment by Craig Wilson [ 07/Jul/16 ]

Thanks Andrew,

That is really weird. I wonder if Mono is doing something different than .NET. I've never seen this behavior before and it seems to run counter to the expectations of the method. We'll look into it.

Craig

Comment by Andrew Stewart [ 07/Jul/16 ]

I've also run into this or a similar issue.

We're running Mono v3.12.2 on CentOS 6.5 using v2.2.4 of the c# driver.

Our application makes around a dozen concurrent connections to the MongoDB, inserts asynchronously a number of documents into a different collection on each connection, and then waits for all of the inserts to complete before moving onto the next batch of data.

After a number of hours, we see the application crashing with an error "MongoDB.Driver.MongoWaitQueueFullException: The wait queue for acquiring a connection to server localhost:27017 is full." which doesn't really make sense as the wait queue size is 1250, and we never have 1250 concurrent connections open.

I instrumented the driver code to log more information on crashes to try to determine what the problem might be. I changed the CheckingOutConnection method in the AcquireConnectionHelper class in ExclusiveConnectionPool.cs to the following - just adding a line to log the wait queue CurrentCount:

public void CheckingOutConnection()
{
	var handler = _pool._checkingOutConnectionEventHandler;
	if (handler != null)
	{
		handler(new ConnectionPoolCheckingOutConnectionEvent(_pool._serverId, EventContext.OperationId));
	}
 
	_enteredWaitQueue = _pool._waitQueue.Wait(0); // don't wait...
	if (!_enteredWaitQueue)
	{
		Console.WriteLine($"There are currently {_pool._waitQueue.CurrentCount} slots available. Queue size is {_pool._settings.WaitQueueSize}.");
		throw MongoWaitQueueFullException.ForConnectionPool(_pool._endPoint);
	}
	_stopwatch = Stopwatch.StartNew();
}

and replaced the dll with the newly built one.

And indeed, after several hours of running, the application crashed again. However, what it logged was

There are currently 1250 slots available. Queue size is 1250.

So the problem isn't that the queue is full - it's that calling _pool._waitQueue.Wait(0) can return false even if there is still room in the wait queue available. I'm not immediately sure of a good way to distinguish between the wait queue actually being full and Wait(0) returning false because it just took too long, but the current error message is misleading at best.

Let me know if there's any other debugging information I could provide about this.

Andrew

Comment by Craig Wilson [ 04/Apr/16 ]

Thanks so much, Shai.

In that timeout exception, there is a HeartbeatException message: System.Runtime.InteropServices.SEHException: External component has thrown an exception. This occurs outside the driver and, because of the nature of this exception, we don't actually know what is going on. So, can you enable network tracing? Specifically, we'll care about System.Net and System.Net.Sockets. If you could provide the traces covering a period where these errors show up, that show prove to be immensely helpful.

Craig

Comment by shai bar [ 04/Apr/16 ]

Hi Craig
I think my code is meet you suggestion and we handling the collection only once in the constructor and using the same instance for every access to mongo

Anyway i changed my code to be like this

CreateClient is called in the constructor

    private IMongoClient m_MongoClient;
 
        public W6MongoDBProvider(string strConnection, string strDatabaseName, string strCollection)
        {
            m_strConnectionString = strConnection;
            m_strCollectionName = strCollection;
            m_strDatabaseName = strDatabaseName;
            CreateClient();
        }
 
 
        private void CreateClient()
        {
            try
            {
                MongoClientSettings objsetinngs = new MongoClientSettings();
                objsetinngs.UseSsl = true;
                objsetinngs.VerifySslCertificate = false;
                objsetinngs.Server = new MongoServerAddress("52.9.56.219", 27017);
                TimeSpan ts = new TimeSpan(0, 0, 5);
                objsetinngs.WaitQueueSize = 10;
 
                List<MongoCredential> Credentials = new List<MongoCredential>();
                Credentials.Add(MongoCredential.CreateCredential("ClickData", "w6-qa", "_w6qa1234"));
                objsetinngs.Credentials = Credentials;
 
                m_MongoClient = new MongoClient(objsetinngs);
 
            }
            catch (Exception ex)
            {
            }
        }
 
        private IMongoCollection<T> GetCollectionConnection()
        {
            try
            {
                IMongoDatabase ClickDataDB = m_MongoClient.GetDatabase(m_strDatabaseName, null);
 
                return ClickDataDB.GetCollection<T>(m_strCollectionName, null);
 
            }
            catch (Exception ex)
            {
                return null;
            }
        }
 
  public void InsertData(List<T> lstObjects)
        {
            IMongoCollection<T> objMongoCollection = GetCollectionConnection();
            objMongoCollection.InsertMany(lstObjects);
        }

And for your questions

1) The timeout exception is this:

ExceptionType: System.TimeoutException , ExceptionMessage: A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = ReadPreferenceServerSelector{ ReadPreference = { Mode = Primary, TagSets = [] } }, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 } }. Client view of cluster state is { ClusterId : "1", ConnectionMode : "Automatic", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "52.9.56.219:27017" }", EndPoint: "52.9.56.219:27017", State: "Disconnected", Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. ---> System.Runtime.InteropServices.SEHException: External component has thrown an exception.
   at MongoDB.Driver.Core.WireProtocol.CommandWireProtocol`1.<ExecuteAsync>d__11.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at MongoDB.Driver.Core.WireProtocol.CommandWireProtocol`1.ExecuteAsync(IConnection connection, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Connections.ConnectionInitializer.<InitializeConnectionAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at MongoDB.Driver.Core.Connections.BinaryConnection.<OpenHelperAsync>d__47.MoveNext()
   --- End of inner exception stack trace ---
   at MongoDB.Driver.Core.Connections.BinaryConnection.<OpenHelperAsync>d__47.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MongoDB.Driver.Core.Servers.ClusterableServer.<HeartbeatAsync>d__42.MoveNext()" }] }.
 
Caller Stack Trace:
                at W6WebApiErrorHandler.ProcessError
                at MethodAttributeExceptionHandling.OnException
                at ExceptionFilterAttribute.OnExceptionAsync
                at <ExecuteExceptionFilterAsyncCore>d__0.MoveNext
                at AsyncMethodBuilderCore.Start
                at ExceptionFilterAttribute.ExecuteExceptionFilterAsyncCore
                at <ExecuteAsync>d__0.MoveNext
                at AsyncMethodBuilderCore.Start
                at ExceptionFilterResult.ExecuteAsync
                at <SendAsync>d__1.MoveNext
                at AsyncMethodBuilderCore.Start
                at HttpControllerDispatcher.SendAsync
                at HttpMessageInvoker.SendAsync
                at HttpRoutingDispatcher.SendAsync
                at <SendAsync>d__0.MoveNext
                at AsyncMethodBuilderCore.Start
                at RestSessionHandler.SendAsync
                at <SendAsync>d__0.MoveNext
                at AsyncMethodBuilderCore.Start
                at HttpServer.SendAsync
                at HttpMessageInvoker.SendAsync
                at <ProcessRequestAsyncCore>d__0.MoveNext
                at AsyncMethodBuilderCore.Start
                at HttpControllerHandler.ProcessRequestAsyncCore
                at TaskAsyncHelper.BeginTask
                at HttpTaskAsyncHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest
                at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute
                at HttpApplication.ExecuteStep
                at PipelineStepManager.ResumeSteps
                at HttpApplication.BeginProcessRequestNotification
                at HttpRuntime.ProcessRequestNotificationPrivate
                at PipelineRuntime.ProcessRequestNotificationHelper
                at PipelineRuntime.ProcessRequestNotification
                at UnsafeIISMethods.MgdIndicateCompletion
                at UnsafeIISMethods.MgdIndicateCompletion
                at PipelineRuntime.ProcessRequestNotificationHelper
                at PipelineRuntime.ProcessRequestNotification
 
 
Technical Details: 
                A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = ReadPreferenceServerSelector{ ReadPreference = { Mode = Primary, TagSets = [] } }, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 } }. Client view of cluster state is { ClusterId : "1", ConnectionMode : "Automatic", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "52.9.56.219:27017" }", EndPoint: "52.9.56.219:27017", State: "Disconnected", Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. ---> System.Runtime.InteropServices.SEHException: External component has thrown an exception.
                   at MongoDB.Driver.Core.WireProtocol.CommandWireProtocol`1.<ExecuteAsync>d__11.MoveNext()
                   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
                   at MongoDB.Driver.Core.WireProtocol.CommandWireProtocol`1.ExecuteAsync(IConnection connection, CancellationToken cancellationToken)
                   at MongoDB.Driver.Core.Connections.ConnectionInitializer.<InitializeConnectionAsync>d__1.MoveNext()
                --- End of stack trace from previous location where exception was thrown ---
                   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
                   at MongoDB.Driver.Core.Connections.BinaryConnection.<OpenHelperAsync>d__47.MoveNext()
                   --- End of inner exception stack trace ---
                   at MongoDB.Driver.Core.Connections.BinaryConnection.<OpenHelperAsync>d__47.MoveNext()
                --- End of stack trace from previous location where exception was thrown ---
                   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                   at MongoDB.Driver.Core.Servers.ClusterableServer.<HeartbeatAsync>d__42.MoveNext()" }] }.
 
Stack Trace:
                   at MongoDB.Driver.Linq.MongoQueryProviderImpl`1.Execute(Expression expression)
                   at MongoDB.Driver.Linq.MongoQueryableImpl`2.GetEnumerator()
                   at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)
                   at W6AuditTrailRestAPIService.Controllers.W6AuditTrailCountController.GetCount(ODataQueryOptions`1 opts)
                   at lambda_method(Closure , Object , Object[] )
                   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
                   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
                   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
                --- End of stack trace from previous location where exception was thrown ---
                   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
                   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()
                --- End of stack trace from previous location where exception was thrown ---
                   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
                   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
                --- End of stack trace from previous location where exception was thrown ---
                   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
                --- End of stack trace from previous location where exception was thrown ---
                   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
                   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
                --- End of stack trace from previous location where exception was thrown ---
                   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
                   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
                --- End of stack trace from previous location where exception was thrown ---
                   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
                   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()

2) when i trying to querying the DB with single request its usually succeed
3) we get this exception even with a low low level load (a several requests)

Comment by Craig Wilson [ 04/Apr/16 ]

The value is per mongo server. Since you only have 1 server listed for the client, then you should see at most 101 (1 for a dedicated heartbeat connection) connections to that server from your client. Your method name (GetCollectionConnection) is a bit of a misnomer as the collection doesn't contain a connection at all. Rather, it is attached to a pool of connections that the MongoClient is holding onto. I'd suggest you create a single instance variable of the MongoClient somewhere and always use that.

The other exception message you have is semi-related. If you start hitting your mongo server with many requests and the client is unable to talk to the server, then you could get a quick escalation to blowing out the wait queue. Eventually, you would start to see TimeoutExceptions as you are showing above. In fact, the TimeoutException is more interesting because it provides us much more information, so:

1) Could you provide the full message of the TimeoutException?
2) Are you able to call your odata method with a single request and see it complete?
3) How much load is required to get to this state (wait queue full)?

Comment by shai bar [ 04/Apr/16 ]

Hi Craig
Thank you for the quick response
our code is like this

the connection string is

mongodb://52.9.33.219:27017/ClickData?ssl=true&sslverifycertificate=false&serverSelectionTimeoutMS=2000

private IMongoCollection<T> m_MongoCollection;
 
public W6MongoDBProvider(string strConnection, string strDatabaseName, string strCollection)
 
{
 
m_strConnectionString = strConnection;
 
m_strCollectionName = strCollection;
 
m_strDatabaseName = strDatabaseName;
 
m_MongoCollection = GetCollectionConnection();
 
}
 
private IMongoCollection<T> GetCollectionConnection()
 
{
 
MongoClient client = new MongoClient(m_strConnectionString);
 
IMongoDatabase ClickDataDB = client.GetDatabase(m_strDatabaseName, null);
 
return ClickDataDB.GetCollection<T>(m_strCollectionName, null);
 
}
 
public IQueryable<T> QueryCollection(ODataQueryOptions opts)
 
{
 
IQueryable<T> icm = opts.ApplyTo(m_MongoCollection.AsQueryable<T>()) as IQueryable<T>;
 
return icm;
 
}

i have a question
you mentioned that " max connection pool size of 100 connections" is this parameter is per client / mongo server ?
sometimes we get another exception
" A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = WritableServerSelector, LatencyLimitingServerSelector

{ AllowedLatencyRange = 00:00:00.0150000 }

}."

but we are working on a single server ... Why the mongo server/ Client think that we have a cluster?
Should i define the server explicitly to be a primary??

Thanx

Shai

Comment by Craig Wilson [ 04/Apr/16 ]

Hi Shai,

Sorry you are having some trouble. There is a max connection pool size of 100 connections(by default) and some multiple of that for the wait queue. Essentially, you have opened so many tasks that haven't yet completeld that you are blowing over that multiple. To help us figure this out, I have a couple of questions:

1) You indicate that you are having issues when talking with linux in the title. Do you not have issues when using windows?
2) Could you provide some code? This is a very general exception and while I know what it is saying and where it is coming from, I don't know why it's happening. Having code would be very helpful in helping us pinpoint exactly what is going on.

Thanks,
Craig

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