<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:46:44 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CSHARP-3939] Unable to aquire connection</title>
                <link>https://jira.mongodb.org/browse/CSHARP-3939</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;div class=&quot;panel&quot; style=&quot;background-color: #fafbfc;border-width: 1px;&quot;&gt;&lt;div class=&quot;panelContent&quot; style=&quot;background-color: #fafbfc;&quot;&gt;
&lt;h3&gt;&lt;a name=&quot;Summary&quot;&gt;&lt;/a&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;/h3&gt;

&lt;p&gt;Hi all,&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;From application I am receiving the following errors&lt;br/&gt;
&#160;_- A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector&lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: { AllowedLatencyRange = 00}&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : &quot;1&quot;, ConnectionMode : &quot;ReplicaSet&quot;, Type : &quot;ReplicaSet&quot;, State : &quot;Disconnected&quot;, Servers : [{ ServerId: &quot;&lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: { ClusterId }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;&quot;, EndPoint: &quot;Unspecified/mongodb-usersegment1.fareportallan.local:27000&quot;, ReasonChanged: &quot;Heartbeat&quot;, State: &quot;Disconnected&quot;, ServerVersion: , TopologyVersion: , Type: &quot;Unknown&quot;, HeartbeatException: &quot;MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server._&lt;br/&gt;
&#160;&lt;em&gt;- Timed out waiting for a connection after 5000ms.&lt;/em&gt;&lt;/p&gt;


&lt;p&gt;Connection string parameter - &lt;em&gt;&lt;font color=&quot;#172b4d&quot;&gt;&lt;ins&gt;authSource=UserSegmentation&amp;amp;authMechanism=SCRAM-SHA-256&amp;amp;replicaSet=userProfiles&amp;amp;connect=replicaSet&amp;amp;safe=true&amp;amp;maxpoolsize=500&amp;amp;socketTimeoutMS=10000&amp;amp;connectTimeoutMS=5000&amp;amp;waitQueueTimeoutMS=5000&amp;amp;readPreference=secondaryPreferred&amp;amp;tls=true&amp;amp;ssl=true&amp;amp;tlsCAFile=/etc/ssl/prod-user-ca.pem&lt;/ins&gt;&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I am using singleton architecture, where single client is created in start-up file is used throughout the application.&lt;/p&gt;

&lt;p&gt;I am also getting error from my health check&lt;br/&gt;
Health check code &amp;gt;&lt;br/&gt;
&lt;em&gt;using var cursor = await _mongoDbConfiguration.MongoClient.GetDatabase(_mongoDbConfiguration.DatabaseName).ListCollectionNamesAsync(cancellationToken: cancellationToken);&lt;/em&gt;&lt;br/&gt;
 &lt;em&gt;await cursor.FirstAsync(cancellationToken);&lt;/em&gt;&lt;br/&gt;
 &lt;em&gt;return HealthCheckResult.Healthy(&quot;A healthy mongoDb.&quot;);&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Error from Health check&lt;br/&gt;
&#160;&lt;em&gt;- at MongoDB.Driver.MongoDatabaseImpl.UsingImplicitSessionAsync&lt;span class=&quot;error&quot;&gt;&amp;#91;TResult&amp;#93;&lt;/span&gt;(Func`2 funcAsync, CancellationToken cancellationToken)&lt;/em&gt;&lt;br/&gt;
 &lt;em&gt;at MongoDB.Driver.MongoDatabaseImpl.ListCollectionNamesAsync(IClientSessionHandle session, ListCollectionNamesOptions options, CancellationToken cancellationToken)&lt;/em&gt;&lt;br/&gt;
 &lt;em&gt;at MongoDB.Driver.MongoDatabaseImpl.ExecuteReadOperationAsync&lt;span class=&quot;error&quot;&gt;&amp;#91;T&amp;#93;&lt;/span&gt;(IClientSessionHandle session, IReadOperation`1 operation, ReadPreference readPreference, CancellationToken cancellationToken)&lt;/em&gt;&lt;br/&gt;
 &lt;em&gt;at MongoDB.Driver.OperationExecutor.ExecuteReadOperationAsync&lt;span class=&quot;error&quot;&gt;&amp;#91;TResult&amp;#93;&lt;/span&gt;(IReadBinding binding, IReadOperation`1 operation, CancellationToken cancellationToken)&lt;/em&gt;&lt;br/&gt;
 &lt;em&gt;at MongoDB.Driver.Core.Operations.ListCollectionsOperation.ExecuteAsync(IReadBinding binding, CancellationToken cancellationToken)&lt;/em&gt;&lt;br/&gt;
 &lt;em&gt;at MongoDB.Driver.Core.Operations.RetryableReadContext.CreateAsync(IReadBinding binding, Boolean retryRequested, CancellationToken cancellationToken)&lt;/em&gt;&lt;br/&gt;
 &lt;em&gt;at MongoDB.Driver.Core.Operations.RetryableReadContext.InitializeAsync(CancellationToken cancellationToken)&lt;/em&gt;&lt;br/&gt;
 &lt;em&gt;at MongoDB.Driver.Core.Servers.Server.GetChannelAsync(CancellationToken cancellationToken)&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;at MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.AcquireConnectionAsync(CancellationToken cancellationToken)&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;at MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.AcquireConnectionHelper.EnteredPoolAsync(Boolean enteredPool, CancellationToken cancellationToken)&lt;/em&gt;&lt;br/&gt;
 &lt;em&gt;at MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.AcquireConnectionHelper.FinalizePoolEnterance(PooledConnection pooledConnection)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt; &lt;em&gt;System.TimeoutException: Timed out waiting for a connection after 5000ms.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Thank you,&lt;br/&gt;
Arjav&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&#160;&lt;/p&gt;
&lt;div class=&quot;panel&quot; style=&quot;background-color: #fafbfc;border-width: 1px;&quot;&gt;&lt;div class=&quot;panelContent&quot; style=&quot;background-color: #fafbfc;&quot;&gt;
&lt;h3&gt;&lt;a name=&quot;Motivation&quot;&gt;&lt;/a&gt;&lt;b&gt;Motivation&lt;/b&gt;&lt;/h3&gt;
&lt;h4&gt;&lt;a name=&quot;Howdoesthisaffecttheenduser%3F&quot;&gt;&lt;/a&gt;How does this affect the end user?&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;They are blocked&lt;/em&gt;&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;Howlikelyisitthatthisproblemorusecasewilloccur%3F&quot;&gt;&lt;/a&gt;How likely is it that this problem or use case will occur?&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;Main path&lt;/em&gt;&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;Iftheproblemdoesoccur%2Cwhataretheconsequencesandhowseverearethey%3F&quot;&gt;&lt;/a&gt;If the problem does occur, what are the consequences and how severe are they?&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;Application fails&lt;/em&gt;&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;Isthisissueurgent%3F&quot;&gt;&lt;/a&gt;Is this issue urgent?&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;yes, i need to solve this within few days&lt;/em&gt;&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;Isthisticketonlyfortests%3F&quot;&gt;&lt;/a&gt;Is this ticket only for tests?&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;No&lt;/em&gt;&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
        <key id="1911859">CSHARP-3939</key>
            <summary>Unable to aquire connection</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="1" iconUrl="https://jira.mongodb.org/images/icons/priorities/blocker.svg">Blocker - P1</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="13202">Works as Designed</resolution>
                                        <assignee username="james.kovacs@mongodb.com">James Kovacs</assignee>
                                    <reporter username="arjav.jain@fareportal.com">Arjav Jain</reporter>
                        <labels>
                            <label>c#</label>
                            <label>mongob</label>
                            <label>timeout</label>
                    </labels>
                <created>Thu, 28 Oct 2021 06:13:20 +0000</created>
                <updated>Fri, 27 Oct 2023 13:24:42 +0000</updated>
                            <resolved>Mon, 1 Nov 2021 16:39:48 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="4160969" author="james.kovacs" created="Mon, 1 Nov 2021 16:39:08 +0000"  >&lt;p&gt;Hi, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=arjav.jain%40fareportal.com&quot; class=&quot;user-hover&quot; rel=&quot;arjav.jain@fareportal.com&quot;&gt;arjav.jain@fareportal.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thank you for letting us know that you found the root cause and that allocating sufficient CPU resources to your application resolved the issue. We have closed this issue.&lt;/p&gt;

&lt;p&gt;Sincerely,&lt;br/&gt;
James&lt;/p&gt;</comment>
                            <comment id="4160505" author="JIRAUSER1263085" created="Mon, 1 Nov 2021 14:51:21 +0000"  >&lt;p&gt;Hi Guys, &lt;br/&gt;
I solve this problem, this is happening because we have not assigned appropriate CPU resource to our application and during Load we were seeing spikes in CPU consumption, increasing the CPU resource solve the problem &lt;br/&gt;
Thanks for the help.&lt;/p&gt;</comment>
                            <comment id="4157751" author="JIRAUSER1257742" created="Fri, 29 Oct 2021 17:16:38 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=arjav.jain%40fareportal.com&quot; class=&quot;user-hover&quot; rel=&quot;arjav.jain@fareportal.com&quot;&gt;arjav.jain@fareportal.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thank you for the additional information.&lt;br/&gt;
The fact that you are observing &quot;wait queue is full&quot;, may indicate that there are too many operations that are waiting for a connection. As maxPoolSize is set to 500, the waitQueueSize would be 2500, translating to 2500 operations waiting for a connection. I would suggest checking whether this is an expected load.&lt;/p&gt;

&lt;p&gt;Also there is a chance that this might be related to &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-3885&quot; title=&quot;[Unconfigurable] connection rate limiter in 2.13.x breaks existing applications&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-3885&quot;&gt;&lt;del&gt;CSHARP-3885&lt;/del&gt;&lt;/a&gt;, it&apos;s worth checking whether this behaviour is reproducible in 2.12.4 driver version.&lt;br/&gt;
To investigate further&#160;it would very helpful to have a standalone reproduction code for this issue.&lt;/p&gt;</comment>
                            <comment id="4156452" author="JIRAUSER1263085" created="Fri, 29 Oct 2021 06:05:41 +0000"  >&lt;p&gt;Hello Boris Dogadov&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;This Does not start occurring after driver update&lt;/li&gt;
	&lt;li&gt;Yes, this become more severe as we add more document to mongoDb and after 30M, we are not able to push single doc to mongo&lt;/li&gt;
	&lt;li&gt;Yes, I am able to ping server and few connection are still active, on mongo we have ~100 connections&lt;/li&gt;
	&lt;li&gt;if we increase connection timeout then we are getting wait queue is full.&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="4156443" author="JIRAUSER1263085" created="Fri, 29 Oct 2021 06:01:16 +0000"  >&lt;p&gt;Hello Dmitry Lukyanov, I am using mongo-csharp-driver&quot;,&quot;version&quot;:&quot;2.13.2.0&quot;&lt;/p&gt;</comment>
                            <comment id="4154924" author="JIRAUSER1257742" created="Thu, 28 Oct 2021 16:12:53 +0000"  >&lt;p&gt;Hello &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=arjav.jain%40fareportal.com&quot; class=&quot;user-hover&quot; rel=&quot;arjav.jain@fareportal.com&quot;&gt;arjav.jain@fareportal.com&lt;/a&gt;,&#160;&lt;br/&gt;
It looks like all the available connections are in use and establishing new ones takes more than 5 seconds. This can happen due to variety of reasons.&lt;/p&gt;

&lt;p&gt;If this behaviour is reproducible, could you please share a simple reproduction code?&lt;/p&gt;

&lt;p&gt;Few questions:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Did this issue start occurring after particular driver version update?&lt;/li&gt;
	&lt;li&gt;Does this occur only after inserting 30M docs?&lt;/li&gt;
	&lt;li&gt;Are you able to ping the server when re-starting the application, with fully populated db?&lt;/li&gt;
	&lt;li&gt;What happens if the connection acquisition timeout is increased from 5 seconds to 60.&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="4154121" author="dmitry.lukyanov" created="Thu, 28 Oct 2021 12:18:16 +0000"  >&lt;p&gt;Hello &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=arjav.jain%40fareportal.com&quot; class=&quot;user-hover&quot; rel=&quot;arjav.jain@fareportal.com&quot;&gt;arjav.jain@fareportal.com&lt;/a&gt; , thank you for your report, please provide a driver version that you use.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hzrkq7:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_11150" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>SERVER fixVersion</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="20500"><![CDATA[5.0]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>