[CSHARP-4464] The connection pool is in paused state Created: 23/Dec/22  Updated: 08/Jan/24  Resolved: 18/Jan/23

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

Type: Task Priority: Major - P3
Reporter: Alisa Fedorenko Assignee: Boris Dogadov
Resolution: Gone away Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Sometimes we  get an alert, which says "The connection pool is in paused state for server ..." 

Requests which we send to mongo db are same from day to day. The time when we do these requests is also the same from day to day. So if I understand it correctly, it cannot be a problem with MaxPoolSize, since in this case we would get these alerts regularly.

For MongoDB drivers we use the last version: 2.18



 Comments   
Comment by Paul Eger [ 08/Jan/24 ]

Hi,

This sporadic issue still occurs. Please note that I work with alisa.fedorenko@digitecgalaxus.ch on the same team.

Usually it occurs if the database is under heavy load, and if we read large amounts of data using a cursor. Please see the stack trace below:

MongoDB.Driver.MongoConnectionPoolPausedException: The connection pool is in paused state for server server:27017. at 
 
MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.PoolState.ThrowIfNotReady() 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.AsyncCursor`1.GetNextBatchAsync(CancellationToken cancellationToken) at MongoDB.Driver.Core.Operations.AsyncCursor`1.MoveNextAsync(CancellationToken cancellationToken) 

Thanks again for your support.

Comment by PM Bot [ 18/Jan/23 ]

There hasn't been any recent activity on this ticket, so we're resolving it. Thanks for reaching out! Please feel free to comment on this if you're able to provide more information.

Comment by Boris Dogadov [ 23/Dec/22 ]

Hi alisa.fedorenko@digitecgalaxus.ch
Yes it's not a problem with MaxPoolSize. MongoConnectionPoolPausedException means that the server is not available, which usually indicates some connectivity issue.

For topologies with transient network failures, operations that use long iterations on AsyncCursor can fail as they assume that the target server is available.
This is a known issue: https://jira.mongodb.org/browse/DRIVERS-2032.

To investigate this further providing logs would be helpful: How to configure logging

Comment by Alisa Fedorenko [ 23/Dec/22 ]

Here is an exception message:

MongoDB.Driver.MongoConnectionPoolPausedException: The connection pool is in paused state for server

{servername}

.
at MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.PoolState.ThrowIfNotReady()
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.AsyncCursor`1.GetNextBatchAsync(CancellationToken cancellationToken)
at MongoDB.Driver.Core.Operations.AsyncCursor`1.MoveNextAsync(CancellationToken cancellationToken)

We do not have these exception very often, just from time to time. Here are all .cases during the last 3 months:
Dec 08 20:50
Dec 03 19:30
Nov 30 07:28
Nov 18 07:18
Nov 15 20:28
Oct 26 20:02
Oct 08 22:02
Oct 07 06:02

As I mentioned above requests which we send to mongo db are same from day to day and the time when we do these requests is also the same from day to day. So I would say that we sent more requests in the time when we got an alert.

mongodb+srv://

{username}

:

{password }

@

{host}

c/?authSource=admin&ssl=false

Comment by Dmitry Lukyanov (Inactive) [ 23/Dec/22 ]

Hello alisa.fedorenko@digitecgalaxus.ch, thanks for your report,

please provide the full exception message (with stack trace) as well as your use case when this exception is triggered. It would be good if you can provide a small repo. Also, what configuration do you have in MongoClientSettings or connectionString (without particular hosts and credentials)? How often this exception happen? Is the application under load at the issue moment?

 

 

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