Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-4850

MongoDB.Driver.MongoWaitQueueFullException

    • Type: Icon: Improvement Improvement
    • Resolution: Works as Designed
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: 2.18.0
    • Component/s: None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      When the number of threads that trie to execute mongodb queries using MongoDb.Driver 2.18, we start to have some threads that hangs for a while (some seconds to 1 minute), then a lot of errors are logged which all point aout the same issue:

      2023-11-16 12:05:53.579 +01:00 [ERR] An error occured while publishing message Domain.Events.IDomainEvent
      MongoDB.Driver.MongoWaitQueueFullException: The wait queue for acquiring a connection to server localhost:27017 is full.
         at MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.AcquireConnectionHelper.AcquireWaitQueueSlot()
         at MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.AcquireConnectionHelper.StartCheckingOut()
         at MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.AcquireConnectionHelper.AcquireConnectionAsync(CancellationToken cancellationToken)
         at MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.AcquireConnectionAsync(CancellationToken cancellationToken)
         at MongoDB.Driver.Core.Servers.Server.GetChannelAsync(CancellationToken cancellationToken)
         at MongoDB.Driver.Core.Operations.RetryableReadContext.InitializeAsync(CancellationToken cancellationToken)
         at MongoDB.Driver.Core.Operations.RetryableReadContext.CreateAsync(IReadBinding binding, Boolean retryRequested, CancellationToken cancellationToken)
         at MongoDB.Driver.Core.Operations.FindOperation`1.ExecuteAsync(IReadBinding binding, CancellationToken cancellationToken)
         at MongoDB.Driver.OperationExecutor.ExecuteReadOperationAsync[TResult](IReadBinding binding, IReadOperation`1 operation, CancellationToken cancellationToken)
         at MongoDB.Driver.MongoCollectionImpl`1.ExecuteReadOperationAsync[TResult](IClientSessionHandle session, IReadOperation`1 operation, ReadPreference readPreference, CancellationToken cancellationToken)
         at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSessionAsync[TResult](Func`2 funcAsync, CancellationToken cancellationToken)
         at Compliance.Wastewater.Infrastructure.PlantAnalysisReports.PlantAnalysisReportRepository.GetPlantAnalysisReportPersistentModel(Guid plantId, DateTime samplingStartDate, Guid finalityTypeId)

       

      I tried to set Min and Max connection pool size to different values 100 to 500 but didn't resolve the issue:

      I tried also to profile the application to find any long queries but I could not find out any. All the times I did it, The first thing that take time based on DotTrace profiler is the Acquire method of the connection pool (I will add some pictures)

            Assignee:
            adelin.mbidaowona@mongodb.com Adelin Mbida Owona
            Reporter:
            mohamed.bouzidi.90@gmail.com Mohamed BOUZIDI
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: