<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:40:46 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-1825] Timeout waiting for connection</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1825</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;When calling InsertOneAsync on IMongoCollection&amp;lt;T&amp;gt;, I am getting following exception. Here is what my code looks like. Since I don&apos;t need to wait for document to be inserted, I call InsertOneAsync and return. This Insert method is rapidly called multiple times.&lt;/p&gt;

&lt;p&gt;public class MyClass{&lt;br/&gt;
private readonly IMongoCollection&amp;lt;T&amp;gt; myColl = MongoDbServer.GetOptionSurfaceDatabase().GetCollection&amp;lt;T&amp;gt;(&quot;MyCollection&quot;);&lt;/p&gt;

&lt;p&gt;public void InsertData(T data)&lt;/p&gt;
{
  myColl..InsertOneAsync(data);
}
&lt;p&gt;...&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;Exception Details:&lt;/p&gt;

&lt;p&gt;2016-11-14 10:44:30,346 &lt;span class=&quot;error&quot;&gt;&amp;#91;30&amp;#93;&lt;/span&gt; ERROR - ERROR: Failed to process item. Timed out waiting for a connection after 120484ms.&lt;br/&gt;
   at MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.AcquireConnectionHelper.EnteredPool(Boolean enteredPool)&lt;br/&gt;
   at MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.AcquireConnection(CancellationToken cancellationToken)&lt;br/&gt;
   at MongoDB.Driver.Core.Servers.Server.GetChannel(CancellationToken cancellationToken)&lt;br/&gt;
   at MongoDB.Driver.Core.Bindings.ServerChannelSource.GetChannel(CancellationToken cancellationToken)&lt;br/&gt;
   at MongoDB.Driver.Core.Bindings.ChannelSourceHandle.GetChannel(CancellationToken cancellationToken)&lt;br/&gt;
   at MongoDB.Driver.Core.Operations.FindOperation`1.Execute(IReadBinding binding, CancellationToken cancellationToken)&lt;br/&gt;
   at MongoDB.Driver.OperationExecutor.ExecuteReadOperation&lt;span class=&quot;error&quot;&gt;&amp;#91;TResult&amp;#93;&lt;/span&gt;(IReadBinding binding, IReadOperation`1 operation, CancellationToken cancellationToken)&lt;br/&gt;
   at MongoDB.Driver.MongoCollectionImpl`1.ExecuteReadOperation&lt;span class=&quot;error&quot;&gt;&amp;#91;TResult&amp;#93;&lt;/span&gt;(IReadOperation`1 operation, ReadPreference readPreference, CancellationToken cancellationToken)&lt;br/&gt;
   at MongoDB.Driver.MongoCollectionImpl`1.ExecuteReadOperation&lt;span class=&quot;error&quot;&gt;&amp;#91;TResult&amp;#93;&lt;/span&gt;(IReadOperation`1 operation, CancellationToken cancellationToken)&lt;br/&gt;
   at MongoDB.Driver.MongoCollectionImpl`1.FindSync&lt;span class=&quot;error&quot;&gt;&amp;#91;TProjection&amp;#93;&lt;/span&gt;(FilterDefinition`1 filter, FindOptions`2 options, CancellationToken cancellationToken)&lt;br/&gt;
   at MongoDB.Driver.FindFluent`2.ToCursor(CancellationToken cancellationToken)&lt;br/&gt;
   at MongoDB.Driver.IAsyncCursorSourceExtensions.ToList&lt;span class=&quot;error&quot;&gt;&amp;#91;TDocument&amp;#93;&lt;/span&gt;(IAsyncCursorSource`1 source, CancellationToken cancellationToken)&lt;br/&gt;
   at Squid.ListenerSvc.DataManager.InsertResponseAsync(Response data)&lt;/p&gt;</description>
                <environment>Windows server 2012 R2</environment>
        <key id="331647">CSHARP-1825</key>
            <summary>Timeout waiting for connection</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="9">Done</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="programmer.guru">Chirag Patel</reporter>
                        <labels>
                            <label>question</label>
                    </labels>
                <created>Mon, 14 Nov 2016 16:44:51 +0000</created>
                <updated>Fri, 5 Apr 2019 13:58:00 +0000</updated>
                            <resolved>Tue, 7 Feb 2017 17:32:35 +0000</resolved>
                                    <version>2.3</version>
                                                    <component>Connectivity</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1433552" author="rstam" created="Mon, 14 Nov 2016 18:52:44 +0000"  >&lt;p&gt;You could use the size of the connection pool as a guide.&lt;/p&gt;

&lt;p&gt;As mentioned above the default connection pool size is 100. That means that at most 100 database operations can be in flight at the same time.&lt;/p&gt;

&lt;p&gt;So you could throttle your application to ensure that no more than 100 database operations are in flight at the same time.&lt;/p&gt;

&lt;p&gt;And if you want more than 100 database operations in flight at the same time you can increase the size of the connection pool, either on the connection string or in MongoClientSettings.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://docs.mongodb.com/manual/reference/connection-string/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/reference/connection-string/&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1433507" author="programmer.guru" created="Mon, 14 Nov 2016 18:17:17 +0000"  >&lt;p&gt;My application has a queue and a single thread dequeues single item from queue and inserts into MongoDB using InsertOneAsync. I&apos;d like to throttle my application, however I don&apos;t know any parameters from MongoDB driver to throttle my app. Are there any methods or properties available on driver that can help me throttle my app?&lt;/p&gt;</comment>
                            <comment id="1433445" author="rstam" created="Mon, 14 Nov 2016 17:26:19 +0000"  >&lt;p&gt;I think you are just trying to do too many things at one.&lt;/p&gt;

&lt;p&gt;The connection pool settings default to having 100 connections and to allowing up to 500 tasks to be waiting for a connection to be come available.&lt;/p&gt;

&lt;p&gt;That means you can have at most 600 tasks in flight at the same time (100 using a connection and 500 more waiting for a connection).&lt;/p&gt;

&lt;p&gt;If you are rapidly firing off InsertOneAsync tasks and not waiting for the response you are probably exceeding the 600 limit.&lt;/p&gt;

&lt;p&gt;You can increase the limits by configuring the connection pool to have more connections or increasing the size of the connection pool&apos;s wait queue.&lt;/p&gt;

&lt;p&gt;A more robust solution would be to throttle your application somehow (for example, limit the number of concurrent tasks to 600).&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|hsrux3:</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>