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

Unable to aquire connection

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Blocker - P1 Blocker - P1
    • None
    • Affects Version/s: None
    • Component/s: None

      Summary

      Hi all,

      I facing issue while connecting to mongodb from dotnet5 application. My application was able to connect to mongodb in the beginning and working fine but as we uploaded 30 million document to mongodb, now my application is not able to create connection to database, this issue is reproducible also like if i clean my mongodb, my application start working again and when i push 30 million document again, my application unable to acquire connection again.

      From application I am receiving the following errors
       _- A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector

      Unknown macro: { AllowedLatencyRange = 00}

      , OperationsCountServerSelector }. Client view of cluster state is { ClusterId : "1", ConnectionMode : "ReplicaSet", Type : "ReplicaSet", State : "Disconnected", Servers : [{ ServerId: "

      Unknown macro: { ClusterId }

      ", EndPoint: "Unspecified/mongodb-usersegment1.fareportallan.local:27000", ReasonChanged: "Heartbeat", State: "Disconnected", ServerVersion: , TopologyVersion: , Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server._
       - Timed out waiting for a connection after 5000ms.

      Connection string parameter - authSource=UserSegmentation&authMechanism=SCRAM-SHA-256&replicaSet=userProfiles&connect=replicaSet&safe=true&maxpoolsize=500&socketTimeoutMS=10000&connectTimeoutMS=5000&waitQueueTimeoutMS=5000&readPreference=secondaryPreferred&tls=true&ssl=true&tlsCAFile=/etc/ssl/prod-user-ca.pem

      I am using singleton architecture, where single client is created in start-up file is used throughout the application.

      I am also getting error from my health check
      Health check code >
      using var cursor = await _mongoDbConfiguration.MongoClient.GetDatabase(_mongoDbConfiguration.DatabaseName).ListCollectionNamesAsync(cancellationToken: cancellationToken);
      await cursor.FirstAsync(cancellationToken);
      return HealthCheckResult.Healthy("A healthy mongoDb.");

      Error from Health check
       - at MongoDB.Driver.MongoDatabaseImpl.UsingImplicitSessionAsync[TResult](Func`2 funcAsync, CancellationToken cancellationToken)
      at MongoDB.Driver.MongoDatabaseImpl.ListCollectionNamesAsync(IClientSessionHandle session, ListCollectionNamesOptions options, CancellationToken cancellationToken)
      at MongoDB.Driver.MongoDatabaseImpl.ExecuteReadOperationAsync[T](IClientSessionHandle session, IReadOperation`1 operation, ReadPreference readPreference, CancellationToken cancellationToken)
      at MongoDB.Driver.OperationExecutor.ExecuteReadOperationAsync[TResult](IReadBinding binding, IReadOperation`1 operation, CancellationToken cancellationToken)
      at MongoDB.Driver.Core.Operations.ListCollectionsOperation.ExecuteAsync(IReadBinding binding, CancellationToken cancellationToken)
      at MongoDB.Driver.Core.Operations.RetryableReadContext.CreateAsync(IReadBinding binding, Boolean retryRequested, CancellationToken cancellationToken)
      at MongoDB.Driver.Core.Operations.RetryableReadContext.InitializeAsync(CancellationToken cancellationToken)
      at MongoDB.Driver.Core.Servers.Server.GetChannelAsync(CancellationToken cancellationToken)
      at MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.AcquireConnectionAsync(CancellationToken cancellationToken)
      at MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.AcquireConnectionHelper.EnteredPoolAsync(Boolean enteredPool, CancellationToken cancellationToken)
      at MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.AcquireConnectionHelper.FinalizePoolEnterance(PooledConnection pooledConnection)

      System.TimeoutException: Timed out waiting for a connection after 5000ms.

      Thank you,
      Arjav

       

      Motivation

      How does this affect the end user?

      They are blocked

      How likely is it that this problem or use case will occur?

      Main path

      If the problem does occur, what are the consequences and how severe are they?

      Application fails

      Is this issue urgent?

      yes, i need to solve this within few days

      Is this ticket only for tests?

      No

            Assignee:
            james.kovacs@mongodb.com James Kovacs
            Reporter:
            arjav.jain@fareportal.com Arjav Jain
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: