<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:39:53 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-1532] ConnectionPool death</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1532</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;So I have been having an intermittent issue where the app is no longer able to connect to the database.   I first increased the number of available connections in the connection pool for a Medium size Azure Website (2gigs of memory) to 400 which decreased the frequency and &lt;b&gt;mostly&lt;/b&gt; made the error go away.   I opened a help ticket with Microsoft and was able to track the error down to running out of memory on one of 3 VMs that are running the site.&lt;/p&gt;

&lt;p&gt;After looking over my code it appears that the error is being caused by the C# driver not recovering once the connection pool gets in a bad state.   Whenever the traffic grows to my site new VMs will automatically be added by Azure and I often have about 6 VMs serving the site.   When an error occurs connecting to Mongo it will only occur on one server and that server will become unresponsive and the error below is what shows up in the error logs.   It appears that after some amount of time the ConnectionPool can get in a bad state and that it never recovers until the site is restarted.&lt;/p&gt;

&lt;p&gt;Error Message:&lt;br/&gt;
System.TimeoutException&lt;br/&gt;
Timed out waiting for a connection after 0ms.&lt;/p&gt;

&lt;p&gt;System.TimeoutException: Timed out waiting for a connection after 0ms.&lt;br/&gt;
   at MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.AcquireConnectionHelper.EnteredPool(Boolean enteredPool)&lt;br/&gt;
   at MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.&amp;lt;AcquireConnectionAsync&amp;gt;d__35.MoveNext()&lt;br/&gt;
&amp;#8212; End of stack trace from previous location where exception was thrown &amp;#8212;&lt;br/&gt;
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&lt;br/&gt;
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&lt;br/&gt;
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()&lt;br/&gt;
   at MongoDB.Driver.Core.Servers.ClusterableServer.&amp;lt;GetChannelAsync&amp;gt;d__40.MoveNext()&lt;br/&gt;
&amp;#8212; End of stack trace from previous location where exception was thrown &amp;#8212;&lt;br/&gt;
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&lt;br/&gt;
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&lt;br/&gt;
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()&lt;br/&gt;
   at MongoDB.Driver.Core.Operations.FindOperation`1.&amp;lt;ExecuteAsync&amp;gt;d__107.MoveNext()&lt;br/&gt;
&amp;#8212; End of stack trace from previous location where exception was thrown &amp;#8212;&lt;br/&gt;
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&lt;br/&gt;
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&lt;br/&gt;
   at MongoDB.Driver.OperationExecutor.&amp;lt;ExecuteReadOperationAsync&amp;gt;d__1`1.MoveNext()&lt;br/&gt;
&amp;#8212; End of stack trace from previous location where exception was thrown &amp;#8212;&lt;br/&gt;
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&lt;br/&gt;
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&lt;br/&gt;
   at MongoDB.Driver.MongoCollectionImpl`1.&amp;lt;ExecuteReadOperationAsync&amp;gt;d__59`1.MoveNext()&lt;br/&gt;
&amp;#8212; End of stack trace from previous location where exception was thrown &amp;#8212;&lt;br/&gt;
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&lt;br/&gt;
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&lt;br/&gt;
   at MongoDB.Driver.IAsyncCursorSourceExtensions.&amp;lt;ToListAsync&amp;gt;d__16`1.MoveNext()&lt;br/&gt;
&amp;#8212; End of stack trace from previous location where exception was thrown &amp;#8212;&lt;br/&gt;
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&lt;br/&gt;
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&lt;br/&gt;
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()&lt;br/&gt;
   at CitySpark.Common.&lt;em&gt;Utilities.Retry.&amp;lt;TimesAsAwaitable&amp;gt;d&lt;/em&gt;_5`1.MoveNext()&lt;br/&gt;
&amp;#8212; End of stack trace from previous location where exception was thrown &amp;#8212;&lt;br/&gt;
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&lt;br/&gt;
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&lt;br/&gt;
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()&lt;br/&gt;
   at CitySpark.EventCache.FlatEventRepo.&amp;lt;GetEventsPagedAsync&amp;gt;d__14.MoveNext()&lt;/p&gt;</description>
                <environment>.net 4.5.2 Azure Websites</environment>
        <key id="247037">CSHARP-1532</key>
            <summary>ConnectionPool death</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="3">Duplicate</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="bret@cityspark.com">Bret Ferrier</reporter>
                        <labels>
                            <label>c#</label>
                            <label>connection</label>
                            <label>driver</label>
                    </labels>
                <created>Wed, 13 Jan 2016 21:32:53 +0000</created>
                <updated>Wed, 20 Jan 2016 06:15:44 +0000</updated>
                            <resolved>Thu, 14 Jan 2016 02:38:20 +0000</resolved>
                                    <version>2.2</version>
                                                    <component>Connectivity</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1148275" author="ravi_drivojoy" created="Wed, 20 Jan 2016 06:15:44 +0000"  >&lt;p&gt;Yes I did upgrade during last week of December and deployed on the servers last Friday and hence the issue. Thanks for the quick patch.&lt;/p&gt;</comment>
                            <comment id="1148103" author="bret@cityspark.com" created="Wed, 20 Jan 2016 00:29:13 +0000"  >&lt;p&gt;This is also a regression in the newer drivers it seems that weren&apos;t out 6 months ago.  So at some point you must have upgraded your drivers.&lt;/p&gt;</comment>
                            <comment id="1147281" author="craiggwilson" created="Tue, 19 Jan 2016 15:20:56 +0000"  >&lt;p&gt;Presumably, your load got a little higher last week. This is reproducible by simply having a higher load.&lt;/p&gt;</comment>
                            <comment id="1147263" author="ravi_drivojoy" created="Tue, 19 Jan 2016 15:03:09 +0000"  >&lt;p&gt;ok thanks just saw that. Now any way to reproduce this issue, reason behind that is as I said we have been running in production for 6 months and never faced this issue and it happened twice in last 1 week.&lt;/p&gt;

&lt;p&gt;Regards&lt;br/&gt;
Ravindra&lt;/p&gt;</comment>
                            <comment id="1147233" author="craiggwilson" created="Tue, 19 Jan 2016 14:38:06 +0000"  >&lt;p&gt;Ravindra,&lt;/p&gt;

&lt;p&gt;It has been released already. You can get it from nuget or github.&lt;/p&gt;

&lt;p&gt;Craig&lt;/p&gt;</comment>
                            <comment id="1147027" author="ravi_drivojoy" created="Tue, 19 Jan 2016 10:43:42 +0000"  >&lt;p&gt;We are running into the same issue, however our site is using mongoDB for the past 6 months with legacy API , but seen this issue for the first time on Saturday and again Today. Recycling the web server process (w3wp.exe) fixes it but that seems to be a temporary solution.&lt;/p&gt;

&lt;p&gt;When can we expect a patch on this.&lt;/p&gt;

&lt;p&gt;Ravi&lt;/p&gt;</comment>
                            <comment id="1135077" author="bret@cityspark.com" created="Thu, 14 Jan 2016 16:52:29 +0000"  >&lt;p&gt;Ok, hopefully that will go out to Nuget soon.&lt;/p&gt;</comment>
                            <comment id="1134536" author="craiggwilson" created="Thu, 14 Jan 2016 02:38:12 +0000"  >&lt;p&gt;Hi Bret,&lt;/p&gt;

&lt;p&gt;Since you have some legacy API involved, I believe the problem is a duplicate of &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1515&quot; title=&quot;Queries using the Legacy API can leak connections resulting in  TimeoutExceptions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1515&quot;&gt;&lt;del&gt;CSHARP-1515&lt;/del&gt;&lt;/a&gt; which we found and fixed today. We&apos;ll be issuing a patch release (2.2.2) very soon to fix this issue. Basically, the legacy API has a bug in it causing connections to not get returned to the pool. So, keep an eye on that one and look for 2.2.2 shortly.&lt;/p&gt;

&lt;p&gt;Craig&lt;/p&gt;</comment>
                            <comment id="1134486" author="bret@cityspark.com" created="Thu, 14 Jan 2016 00:48:34 +0000"  >&lt;p&gt;Craig,  our code base contains calls that utilize both the legacy and the new API.  With that being said the &quot;hot&quot; paths that are called most often have been converted to use the Async version of the new API and that is where I am seeing the errors as 95% of the traffic is for the same few pages that mainly use the Async version (You can see in the call stack that it is calling ToListAsync.&lt;/p&gt;

&lt;p&gt;I have tried to get a mini/full dump of the server when it was in an error state but don&apos;t have the same kind of access as its a Azure Website and there wasn&apos;t enough memory on the machine left to do a dump.  It really seems like the ConnectionPool gets poisoned and never recovers,  new servers are spun up but the one is a lame duck.&lt;/p&gt;</comment>
                            <comment id="1134296" author="craiggwilson" created="Wed, 13 Jan 2016 21:35:22 +0000"  >&lt;p&gt;Hi Bret,&lt;/p&gt;

&lt;p&gt;Are you using the legacy API or the new API? And are you using the sync or async versions?&lt;/p&gt;

&lt;p&gt;Craig&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="244490">CSHARP-1515</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <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|hsfex3:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>