<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:38:47 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-1144] Investigate tests busting over the wait queue size</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1144</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;See here for an example: &lt;a href=&quot;https://travis-ci.org/mongodb/mongo-csharp-driver/builds/42987125#L255&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://travis-ci.org/mongodb/mongo-csharp-driver/builds/42987125#L255&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="173016">CSHARP-1144</key>
            <summary>Investigate tests busting over the wait queue size</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</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="craig.wilson@mongodb.com">Craig Wilson</reporter>
                        <labels>
                    </labels>
                <created>Fri, 5 Dec 2014 20:02:43 +0000</created>
                <updated>Thu, 17 Mar 2022 14:24:36 +0000</updated>
                            <resolved>Thu, 22 Oct 2020 15:11:32 +0000</resolved>
                                                                                        <votes>11</votes>
                                    <watches>18</watches>
                                                                                                                <comments>
                            <comment id="1829761" author="jeff.yemin" created="Sat, 10 Mar 2018 13:11:31 +0000"  >&lt;p&gt;PR: &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/pull/316&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/pull/316&lt;/a&gt;&lt;br/&gt;
Note: this PR was not merged&lt;/p&gt;</comment>
                            <comment id="1642455" author="jstafford@digitalairstrike.com" created="Mon, 7 Aug 2017 22:21:42 +0000"  >&lt;p&gt;Are we sure this is limited to Mono? I&apos;m having the same issue in plain ole .Net. I have my max connection pool set to 165, my max wait queue set to 3 times that, and I&apos;m using a SemaphoreSlim set to 100 but I&apos;m still getting errors stating the wait queue is full.&lt;/p&gt;</comment>
                            <comment id="1377554" author="dburden" created="Tue, 6 Sep 2016 18:26:00 +0000"  >&lt;p&gt;That makes sense. Next time we perform server maintenance, we will update our mono and see if the issue persists.&lt;/p&gt;</comment>
                            <comment id="1376992" author="rmunn" created="Tue, 6 Sep 2016 08:50:32 +0000"  >&lt;p&gt;Drew Burden&apos;s comment led me to search the Mono source code, and I believe I&apos;ve found the race condition in Mono that&apos;s triggering this bug. In Mono 3.12 and earlier, the SemaphoreSlim implementation of &lt;a href=&quot;https://github.com/mono/mono/blob/mono-3.12.0-branch/mcs/class/corlib/System.Threading/SemaphoreSlim.cs#L132&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Wait(int millisecondsTimeout, CancellationToken cancellationToken)&lt;/a&gt; looks like this in relevant part:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;Watch sw = Watch.StartNew ();&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;Func&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;bool&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&amp;gt; stopCondition = () =&amp;gt; millisecondsTimeout &amp;gt;= 0 &amp;amp;&amp;amp; sw.ElapsedMilliseconds &amp;gt; millisecondsTimeout;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;do&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;bool&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; shouldWait;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; result;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;do&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;		cancellationToken.ThrowIfCancellationRequested ();&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; (stopCondition ())&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;		shouldWait = &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;		result = currCount;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; (result &amp;gt; 0)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;			shouldWait = &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;else&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;	} &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; (Interlocked.CompareExchange (&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;ref&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; currCount, result - 1, result) != result);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; (!shouldWait) {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; (result == 1)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;			handle.Reset ();&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;	}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #008200; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;// Snip some code that uses SpinWait to yield control for a while before continuing the outer loop&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;} &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;Note the order of those first few lines: &lt;b&gt;first&lt;/b&gt; the stop condition is checked, and &lt;b&gt;then&lt;/b&gt; the current count is examined. If SemaphoreSlim.Wait is called with a timeout of 0 ms, and it just so happens that between the time the stopwatch is started and the time the stop condition is checked, at least 1 millisecond has already elapsed (because the server was under heavy load), then the current count will never be examined, and Wait() will return &lt;tt&gt;false&lt;/tt&gt; even though the wait queue was far from full.&lt;/p&gt;

&lt;p&gt;In Mono 4.0, they switched to using the Microsoft reference sources for SemaphoreSlim, and the Microsoft reference sources don&apos;t suffer from this race condition. So that&apos;s why some people have reported that this bug goes away in Mono 4.0 &amp;#8211; because in Mono 4.0, SemaphoreSlim.Wait(0) no longer reports spurious failures.&lt;/p&gt;

&lt;p&gt;But in Mono 3.12 and earlier, SemaphoreSlim.Wait(0) cannot be relied upon. If it returns &lt;tt&gt;false&lt;/tt&gt;, it might be because 1 ms &lt;b&gt;just happened&lt;/b&gt; to pass between when it started its timer and when it first tried to check the number of available threads &amp;#8211; and since it checks the timer before checking the number of available threads in the queue, it will return spurious failures, which then turn into MongoWaitQueueExceptions being incorrectly thrown.&lt;/p&gt;</comment>
                            <comment id="1376157" author="dburden" created="Fri, 2 Sep 2016 23:25:46 +0000"  >&lt;p&gt;On line 408 of ExclusiveConnectionPool.cs&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;thead&gt;
			&lt;tr id=&quot;syntaxplugin_title&quot;&gt;
			&lt;td bgcolor=&quot;#f5f5f5&quot; style=&quot;font-family: Arial,sans-serif; color: #333; border-bottom: 1px solid #bbb; background-color: #f5f5f5 !important; font-weight: bold; line-height: 1em;&quot; &gt;
				&lt;p style=&quot;margin: 5px 10px; padding: 0;&quot;&gt;ExclusiveConnectionPool.cs&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/thead&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;_enteredWaitQueue = _pool._waitQueue.Wait(0); // don&apos;t wait...&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;if (!_enteredWaitQueue)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    throw MongoWaitQueueFullException.ForConnectionPool(_pool._endPoint);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;I see that it is calling this method on the SemaphoreSlim: &lt;a href=&quot;https://msdn.microsoft.com/en-us/library/dd289488(v=vs.110).aspx&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://msdn.microsoft.com/en-us/library/dd289488(v=vs.110).aspx&lt;/a&gt; with an argument of 0ms. When this method returns false (indicating the semaphore is not entered), it will throw the WaitQueueFullException, even if the wait queue isn&apos;t full. The thread just has to fail to enter the semaphore, and the driver will think the queue is full. Is it possible that some sort of race condition is causing the wait to fail immediately since it is given no time to actually wait?&lt;/p&gt;</comment>
                            <comment id="1376153" author="dburden" created="Fri, 2 Sep 2016 23:14:43 +0000"  >&lt;p&gt;We downloaded and recompiled the source code for the C# driver, and we put in some debug output logging the size of the wait queue any time something is trying to be added to it. We watched the wait queue slots maintain around 20,000 slots available (our arbitrarily high queue limit), dipping occasionally to 19,995 or so, and then all of a sudden, we get the wait queue full exception. Then right after the exception, we will see it saying that there&apos;s still around 20k available slots in the queue. This seems to suggest that the wait queue exception is being thrown under circumstances in which the wait queue is not actually full. Unfortunately, I don&apos;t know enough about the inner workings of the driver to be able to provide any good ideas as to why this might be happening.&lt;/p&gt;</comment>
                            <comment id="1375814" author="dburden" created="Fri, 2 Sep 2016 17:06:10 +0000"  >&lt;p&gt;We are having issues with this as well. Our wait queue seems to fill up even though the connections in our pool have not yet been used. Or, if they are being used, something else weird is going on. We have a client connection pool size of 8192, yet mongostat never shows more than about 600 connections at any given time, even though mongo reports something like 50k connections available. This is severely detrimental to our production environment, as it is causing data to be lost when the wait queue exception is thrown.&lt;/p&gt;</comment>
                            <comment id="1266437" author="davenewza" created="Tue, 17 May 2016 16:20:03 +0000"  >&lt;p&gt;I&apos;m experiencing the same problem while using around 10 parallel InsertManyAsync(collection) calls.  The collections inserted are only a few hundred, small documents.&lt;/p&gt;</comment>
                            <comment id="1223576" author="zeioth" created="Sun, 3 Apr 2016 19:41:35 +0000"  >&lt;p&gt;I&apos;m recieving the same exception.  I&apos;m performing 3 find operations of 1m results each one:&lt;br/&gt;
&lt;a href=&quot;http://pastebin.com/Xd2WEjKL&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://pastebin.com/Xd2WEjKL&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My only alternative right now is to do it sync.&lt;/p&gt;</comment>
                            <comment id="1209692" author="dragos_c" created="Mon, 21 Mar 2016 15:24:03 +0000"  >&lt;p&gt;I must admit, I agree with ZunTzu. If you&apos;re really close to the maximum number of waiting elements - it&apos;s enough a small network jam to make everything explode.&lt;/p&gt;

&lt;p&gt;Currently, I was able to reach this problem only by inserting around 1M documents via InsertManyAsync from a single thread (ok, the call was made from a single-thread in the entire application).&lt;/p&gt;</comment>
                            <comment id="1061678" author="zuntzu" created="Thu, 15 Oct 2015 15:51:44 +0000"  >&lt;p&gt;Maybe the timeout parameter was not such a great idea after all. It doesn&apos;t matter: I am more interested in blocking than throwing anyway.&lt;/p&gt;

&lt;p&gt;Increasing the wait queue size &lt;b&gt;will not help&lt;/b&gt; in my use case. Imagine you want to insert millions (or more) of documents using the .NET driver. There would be no correct value for the size of the queue. The only viable solution right now would be to throttle the program, for instance by Waiting on every task, to avoid running out of memory. It is possible to do this, but it is a bit awkward.&lt;/p&gt;

&lt;p&gt;For the time being I will work around the exception with my own throttling algorithm. Thanks for the insight into the working of the driver.&lt;/p&gt;</comment>
                            <comment id="1061624" author="craiggwilson" created="Thu, 15 Oct 2015 15:25:01 +0000"  >&lt;p&gt;I&apos;m not sure this is unexpected. There is a constrained set of resources (connections) and a well-defined and tunable wait-queue size to get in line for those connections. Once that queue is full, I don&apos;t think anyone would expect that we&apos;d have yet another queue...&lt;/p&gt;

&lt;p&gt;However, we can emulate the behavior you want already. Set the wait queue size to a very, very large number such that you will never hit it. Subsequently, you can provide a cancellation token which will be used once inside the wait queue. You can provide any type of a cancellation token, including one that has a timeout associated with it. Since we accept cancellation tokens everywhere, we have not provided any timeout values on calls like this.&lt;/p&gt;

&lt;p&gt;As far as the behavior you are looking for, just set a very large wait queue size and you&apos;ll never hit this issue.&lt;/p&gt;

&lt;p&gt;Craig&lt;/p&gt;</comment>
                            <comment id="1061575" author="zuntzu" created="Thu, 15 Oct 2015 15:09:47 +0000"  >&lt;p&gt;Hi Craig, thanks for the swift reply. It is really nice to get a rapid response!&lt;/p&gt;

&lt;p&gt;If I understand correctly your strategy is to accumulate resources downstream (wait queue entries) in order to avoid accumulating resources upstream (threads or other application resources).&lt;br/&gt;
A different solution would be to be able to slow down the producers upstream to match the max sustained throughput of the consumer (MongoDB)  downstream.&lt;/p&gt;

&lt;p&gt;A way to meet everyone&apos;s needs would be to add a timeout parameter to InsertOneAsync and other similar methods.&lt;/p&gt;

&lt;p&gt;That way three choices would be readily available:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;a zero timeout would throw immediately if the queue was full (this is the current behavior)&lt;/li&gt;
	&lt;li&gt;a infinite timeout would block synchronously until an entry is available in the queue (the behavior I am looking for)&lt;/li&gt;
	&lt;li&gt;a finite timeout would provide an intermediate solution: the call would block for a reasonable duration - application-dependent - and then would throw.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;A benefit of adding this parameter is that the behavior would be more apparent to developers. I must confess I was surprised by the current behavior.&lt;/p&gt;</comment>
                            <comment id="1061500" author="craiggwilson" created="Thu, 15 Oct 2015 14:33:19 +0000"  >&lt;p&gt;Hi ZunTzu,&lt;/p&gt;

&lt;p&gt;Have you increased the default wait queue size and still hit this issue? Perhaps increase it more?&lt;/p&gt;

&lt;p&gt;We chose not to wait here because the wait queue is already full. The wait queue size is much larger than the connection pool size already. When it&apos;s full, we throw. If we don&apos;t do this, there is a chance that threads pile up here, wait for extremely long periods of time, and might even cause a memory problem.&lt;/p&gt;

&lt;p&gt;Craig&lt;/p&gt;</comment>
                            <comment id="1061492" author="zuntzu" created="Thu, 15 Oct 2015 14:29:07 +0000"  >&lt;p&gt;Hi! I am encountering this problem time and time again.&lt;br/&gt;
I am considering implementing a workaround but I would like to be sure I understand the origin of the problem correctly.&lt;br/&gt;
As far as I understand the exception is thrown when the wait queue semaphore exceeds settings.WaitQueueSize :&lt;/p&gt;

&lt;p&gt;ExclusiveConnectionPool.cs, line 155 :&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;enteredWaitQueue = _waitQueue.Wait(0); // don&apos;t wait...&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;if (!enteredWaitQueue)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    throw MongoWaitQueueFullException.ForConnectionPool(_endPoint);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;My question is: why did you choose to throw an exception &lt;b&gt;instead of waiting&lt;/b&gt; for the semaphore?&lt;br/&gt;
The reason I am asking is that I&apos;m considering using a semaphore at the application level that would replicate precisely that behavior.&lt;/p&gt;</comment>
                            <comment id="938405" author="skumarvenkat@gmail.com" created="Thu, 11 Jun 2015 22:36:08 +0000"  >&lt;p&gt;thank you craig, yes it is working fine as expected in 2.0.1 drivers.&lt;/p&gt;

&lt;p&gt;Venkak&lt;/p&gt;</comment>
                            <comment id="937876" author="craiggwilson" created="Thu, 11 Jun 2015 16:56:03 +0000"  >&lt;p&gt;Hi venkat,&lt;/p&gt;

&lt;p&gt;Have you increased the wait queue size? The default is 500, which is likely much too low in a web application. The ticket &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1264&quot; title=&quot;Wait Queue Size setting doesn&amp;#39;t affect the server selection wait queue size.&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1264&quot;&gt;&lt;del&gt;CSHARP-1264&lt;/del&gt;&lt;/a&gt; was fixed in 2.0.1, so setting the WaitQueueSize on MongoClientSettings or in the connection string will set it properly.&lt;/p&gt;

&lt;p&gt;Craig&lt;/p&gt;</comment>
                            <comment id="937872" author="skumarvenkat@gmail.com" created="Thu, 11 Jun 2015 16:54:10 +0000"  >&lt;p&gt;We are getting following error still.&lt;br/&gt;
Mongodb 3.0 running on windows 2008 r2&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;MongoDB.Driver.MongoWaitQueueFullException&amp;#93;&lt;/span&gt; = &lt;/p&gt;
{&quot;The wait queue for acquiring a connection to server full.&quot;}

&lt;p&gt;It is critical issue and we cant go into production, please provide work around.&lt;/p&gt;</comment>
                            <comment id="902864" author="jakesjews" created="Fri, 1 May 2015 03:08:51 +0000"  >&lt;p&gt;I&apos;m not 100% sure if this is the case, but after we upgraded our server from mono 3.12 to 4.0 the issue with the wait queue seems to have gone away.&lt;/p&gt;</comment>
                            <comment id="900757" author="daniel.moqvist@knowit.se" created="Wed, 29 Apr 2015 11:10:35 +0000"  >&lt;p&gt;We are also seeing this outside of unit testing. We have not moved on to use the new async API in the driver, we have just ported our code from driver 1.10 to 2.0 and using the commands in the legacy driver assembly. We are runing the Save and Find methods in a Parallel.ForEach. We never had the problem with the old 1.10 driver, but it came with the 2.0 driver. We are running in Windows environment.&lt;/p&gt;

&lt;p&gt;The exception we get is:&lt;br/&gt;
MongoDB.Driver.MongoWaitQueueFullException: The wait queue for acquiring a connection to server 192.168.0.100:1 is full.&lt;/p&gt;

&lt;p&gt;   at MongoDB.Driver.Core.ConnectionPools.ExclusiveConnectionPool.&amp;lt;AcquireConnectionAsync&amp;gt;d__0.MoveNext()&lt;/p&gt;

&lt;p&gt;&amp;#8212; End of stack trace from previous location where exception was thrown &amp;#8212;&lt;/p&gt;

&lt;p&gt;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&lt;/p&gt;

&lt;p&gt;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&lt;/p&gt;

&lt;p&gt;   at MongoDB.Driver.Core.Servers.ClusterableServer.&amp;lt;GetChannelAsync&amp;gt;d__0.MoveNext()&lt;/p&gt;

&lt;p&gt;&amp;#8212; End of stack trace from previous location where exception was thrown &amp;#8212;&lt;/p&gt;

&lt;p&gt;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&lt;/p&gt;

&lt;p&gt;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&lt;/p&gt;

&lt;p&gt;   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()&lt;/p&gt;

&lt;p&gt;   at MongoDB.Driver.Core.Operations.FindOperation`1.&amp;lt;ExecuteAsync&amp;gt;d__2.MoveNext()&lt;/p&gt;

&lt;p&gt;&amp;#8212; End of stack trace from previous location where exception was thrown &amp;#8212;&lt;/p&gt;

&lt;p&gt;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&lt;/p&gt;

&lt;p&gt;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&lt;/p&gt;

&lt;p&gt;   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()&lt;/p&gt;

&lt;p&gt;   at MongoDB.Driver.Sync.IOperationExtensions.Execute&lt;span class=&quot;error&quot;&gt;&amp;#91;TResult&amp;#93;&lt;/span&gt;(IReadOperation`1 operation, IReadBinding binding, CancellationToken cancellationToken)&lt;/p&gt;

&lt;p&gt;   at MongoDB.Driver.MongoCursor`1.GetEnumerator()&lt;/p&gt;

&lt;p&gt;   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)&lt;/p&gt;
</comment>
                            <comment id="898792" author="craiggwilson" created="Mon, 27 Apr 2015 15:15:49 +0000"  >&lt;p&gt;Yes, we are still trying to determine if this is expected or not. The issue relates to the fact that, since we are async, we are handing the threads back to ASP.NET which makes it think it can do more. However, we still have a connection pool that has a max size, so at some point, your app is going to try to do more than the driver is allowed to handle. While MongoDB and the driver can handle the load, I&apos;ve only seen this issue show up when a network issue happens and one or more servers get disconnected temporarily.  We are still working through the best way to combat this problem.&lt;/p&gt;

&lt;p&gt;Craig&lt;/p&gt;</comment>
                            <comment id="898786" author="JIRAUSER1257127" created="Mon, 27 Apr 2015 15:11:05 +0000"  >&lt;p&gt;I have seen this outside of unit testing recently and am investigating if the use of Parallel.ForEach without any ParallelOptions (like MaxDegreeOfParallelism) set is causing it.  &lt;/p&gt;</comment>
                            <comment id="875828" author="jakesjews" created="Wed, 8 Apr 2015 15:33:03 +0000"  >&lt;p&gt;We&apos;ve been seeing this after upgrading to the new mongo driver with our tests and on our QA api. Our code is relatively the unchanged from the 1.10 driver. We&apos;ve tried increasing the maxPoolSize to 300 but we still get the error occasionally. &lt;/p&gt;</comment>
                            <comment id="822242" author="rstam" created="Thu, 5 Feb 2015 14:50:28 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1180&quot; title=&quot;The wait queue for acquiring a connection to server is full&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1180&quot;&gt;&lt;del&gt;CSHARP-1180&lt;/del&gt;&lt;/a&gt; is not exactly the same thing. In &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1180&quot; title=&quot;The wait queue for acquiring a connection to server is full&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1180&quot;&gt;&lt;del&gt;CSHARP-1180&lt;/del&gt;&lt;/a&gt; we have 100,000 Tasks attempting to simultaneously request a connection (with the default connection pool settings of 100 connections and a wait queue size of 500). In that scenario we expect to get a wait queue full exception.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1144&quot; title=&quot;Investigate tests busting over the wait queue size&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1144&quot;&gt;&lt;del&gt;CSHARP-1144&lt;/del&gt;&lt;/a&gt; is occurring when running the unit tests. Supposedly unit tests are run one at a time (no parallelism), so in this ticket the wait queue exception truly was not expected.&lt;/p&gt;</comment>
                            <comment id="822194" author="craiggwilson" created="Thu, 5 Feb 2015 13:53:35 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1180&quot; title=&quot;The wait queue for acquiring a connection to server is full&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1180&quot;&gt;&lt;del&gt;CSHARP-1180&lt;/del&gt;&lt;/a&gt; has a simple repro.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="182671">CSHARP-1180</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="201287">CSHARP-1264</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                    <customfield id="customfield_13552" key="com.go2group.jira.plugin.crm:crm_generic_field">
                        <customfieldname>Case</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[[5002K00000ejooSQAQ, 5002K00000nD6rUQAS, 5002K00000f2hOLQAY, 500A000000cGGA0IAO]]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <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|hrev4n:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="391">C# Sprint 15</customfieldvalue>
    <customfieldvalue id="441">C# Sprint 16</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>