<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:41:39 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-2115] Highly contested startup doesn&apos;t resolve itself properly</title>
                <link>https://jira.mongodb.org/browse/CSHARP-2115</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Not sure how to state this differently than the title. If we startup with 100 tasks (threads) on a non-discovered cluster, discovery takes longer to complete causing some (or all) of the requests to fail.&lt;/p&gt;

&lt;p&gt;There is something going on with a highly contested startup, likely as it relates to SDAM.&lt;/p&gt;</description>
                <environment></environment>
        <key id="465274">CSHARP-2115</key>
            <summary>Highly contested startup doesn&apos;t resolve itself properly</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="13202">Works as Designed</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="craig.wilson@mongodb.com">Craig Wilson</reporter>
                        <labels>
                    </labels>
                <created>Wed, 29 Nov 2017 15:47:10 +0000</created>
                <updated>Fri, 27 Oct 2023 13:25:04 +0000</updated>
                            <resolved>Fri, 25 Jan 2019 19:38:37 +0000</resolved>
                                                                    <component>Connectivity</component>
                                        <votes>1</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="2127999" author="rstam" created="Fri, 25 Jan 2019 19:34:45 +0000"  >&lt;p&gt;I was unable to reproduce this at first, until I managed to get my hands on the original test program. Turns out the original test program was using &lt;tt&gt;Task.Run&lt;/tt&gt; to simulate async over sync, which is not recommended. If you create enough &lt;tt&gt;Tasks&lt;/tt&gt; that all end up blocking they end up consuming all the threads from the pool that the async machinery uses to run &lt;tt&gt;Tasks&lt;/tt&gt;. In our case, all those blocked &lt;tt&gt;Tasks&lt;/tt&gt; were preventing the driver&apos;s own heartbeat &lt;tt&gt;Tasks&lt;/tt&gt; from running and therefore interfering with server discovery and monitoring.&lt;/p&gt;

&lt;p&gt;If you run the attached test program you can confirm that the test runs fine with either 1000 pure sync &lt;tt&gt;Threads&lt;/tt&gt; or 1000 pure async &lt;tt&gt;Tasks&lt;/tt&gt;. But even only 100 fake async &lt;tt&gt;Tasks&lt;/tt&gt; is&#160; enough to jam up the thread pool.&lt;/p&gt;

&lt;p&gt;So the workaround for this issue is to either use 100% pure sync calls or 100% pure async calls, but don&apos;t try to fake async over sync.&lt;/p&gt;

&lt;p&gt;One interesting article about mis-using &lt;tt&gt;Task.Run&lt;/tt&gt; this way is:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://blog.stephencleary.com/2013/11/taskrun-etiquette-examples-using.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://blog.stephencleary.com/2013/11/taskrun-etiquette-examples-using.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="678159">CSHARP-2490</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="207250" name="Program.cs" size="3483" author="robert@mongodb.com" created="Fri, 25 Jan 2019 19:27:34 +0000"/>
                    </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|htcq1z:</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>