<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:42:25 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-2390] Intermittent Server Selection Connection Timeout on Server Startup</title>
                <link>https://jira.mongodb.org/browse/CSHARP-2390</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;This is a copy and paste of a post I made in the Google forum. It doesn&apos;t appear anyone is active there (I may be wrong) so I&apos;m creating a bug report over here.&lt;/p&gt;


&lt;hr /&gt;
&lt;p&gt;&lt;b&gt;Here is some information about our setup:&lt;/b&gt;&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;MongoDB version:&#160;3.2.10&lt;/li&gt;
	&lt;li&gt;Driver version: 2.5.0&lt;/li&gt;
	&lt;li&gt;Replicaset with 3 nodes (1 primary, 2 secondary)&lt;/li&gt;
	&lt;li&gt;MongoDB is hosted in Azure on a VM.&lt;/li&gt;
	&lt;li&gt;Services that connect with mongoDB are running in an Azure Web App.&lt;/li&gt;
	&lt;li&gt;Connection string:&#160;mongodb://username:password@server1.xxx.com:270xx,server2.xxx.com:270xx,server3.xxx.com:270xx/?replicaSet=repSetName&amp;amp;maxIdleTimeMS=60000&quot;&lt;br/&gt;
&#160;&lt;br/&gt;
&lt;b&gt;The problem:&lt;/b&gt;&#160;&lt;br/&gt;
When a new server instance is created due to autoscale trigger rules,&#160;&lt;b&gt;sometimes&lt;/b&gt;&#160;the mongo client will throw the following error on the new instance (but not always; it&apos;s intermittent):&lt;br/&gt;
&#160;&lt;br/&gt;
&#160;&lt;br/&gt;
A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector
{ AllowedLatencyRange = 00:00:00.0150000 }
&lt;p&gt; }. Client view of cluster state is { ClusterId : &quot;1&quot;, ConnectionMode : &quot;Automatic&quot;, Type : &quot;ReplicaSet&quot;, State : &quot;Disconnected&quot;, Servers : [&lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: { ServerId}&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;, { ServerId: &quot;&lt;/p&gt;
{ ClusterId : 1, EndPoint : &quot;Unspecified/server1.azure.com:270xx&quot; }
&lt;p&gt;&quot;, EndPoint: &quot;Unspecified/server1.azure.com:270xx&quot;, State: &quot;Disconnected&quot;, Type: &quot;Unknown&quot; }, { ServerId: &quot;&lt;/p&gt;
{ ClusterId : 1, EndPoint : &quot;Unspecified/server2.azure.com:270xx&quot; }
&lt;p&gt;&quot;, EndPoint: &quot;Unspecified/server2.azure.com:270xx&quot;, State: &quot;Disconnected&quot;, Type: &quot;Unknown&quot; }] }.&lt;br/&gt;
&#160; &#160;at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description)&lt;br/&gt;
&#160; &#160;at MongoDB.Driver.Core.Clusters.Cluster.SelectServerHelper.WaitingForDescriptionToChange()&lt;br/&gt;
&#160; &#160;at MongoDB.Driver.Core.Clusters.Cluster.SelectServer(IServerSelector selector, CancellationToken cancellationToken)&lt;br/&gt;
&#160; &#160;at MongoDB.Driver.MongoClient.AreSessionsSupportedAfterServerSelection(CancellationToken cancellationToken)&lt;br/&gt;
&#160; &#160;at MongoDB.Driver.MongoClient.AreSessionsSupported(CancellationToken cancellationToken)&lt;br/&gt;
&#160; &#160;at MongoDB.Driver.OperationExecutor.StartImplicitSession(CancellationToken cancellationToken)&lt;br/&gt;
&#160; &#160;at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSession&lt;span class=&quot;error&quot;&gt;&amp;#91;TResult&amp;#93;&lt;/span&gt;(Func`2 func, CancellationToken cancellationToken)&lt;br/&gt;
&#160; &#160;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;
&#160; &#160;at MongoDB.Driver.FindFluent`2.ToCursor(CancellationToken cancellationToken)&lt;br/&gt;
&#160; &#160;at MongoDB.Driver.IAsyncCursorSourceExtensions.FirstOrDefault&lt;span class=&quot;error&quot;&gt;&amp;#91;TDocument&amp;#93;&lt;/span&gt;(IAsyncCursorSource`1 source, CancellationToken cancellationToken)&lt;br/&gt;
&#160; &#160;at MongoDB.Driver.IFindFluentExtensions.FirstOrDefault&lt;span class=&quot;error&quot;&gt;&amp;#91;TDocument,TProjection&amp;#93;&lt;/span&gt;(IFindFluent`2 find, CancellationToken cancellationToken)&lt;br/&gt;
&#160; &#160;....&lt;br/&gt;
&#160;&lt;br/&gt;
The error will continue to appear until we restart the problematic instance.&#160;&lt;br/&gt;
&#160;&lt;br/&gt;
I&apos;ve collected network traces using Azure&apos;s diagnostic tools and I was able to find the trace file that corresponds to the bad instance throwing the error mentioned above. This is what I found:&lt;/p&gt;&lt;/li&gt;
	&lt;li&gt;There are periodic calls from the service to mongo for &quot;isMaster&quot; and &quot;buildInfo&quot; requests.The server responds successfully on each and every request.&lt;/li&gt;
	&lt;li&gt;On a good server instance, hitting an endpoint that makes a request to mongo will immediately contact mongo for requested data.&#160;&lt;/li&gt;
	&lt;li&gt;On a bad server instance (one that is throwing the error mentioned above), the HTTP request will come in but will immediately throw a 500 error with the above error.&lt;/li&gt;
	&lt;li&gt;There are 0 errors on the server side being recorded.&#160;&#160;&lt;br/&gt;
&#160;&lt;br/&gt;
So even though the driver can successfully communicate with the server using isMaster and buildInfo query requests, it fails to make any requests for data and immediately returns the above error message.&lt;br/&gt;
&#160;&lt;br/&gt;
I don&apos;t know if it means anything to you, but I&apos;ve noticed that our connection string lists the servers as Primary (west-us region), Secondary1 (west-us region), and then Secondary2 (east-us region). The error message lists the servers as Secondary2, Primary, Secondary1. Though we have server instances in west and east US that are experiencing this issue.&lt;br/&gt;
&#160;&lt;br/&gt;
I&apos;m stumped and would appreciate any help.&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment>MongoDB version 3.2.10 running on Windows Server 2008 R2</environment>
        <key id="607315">CSHARP-2390</key>
            <summary>Intermittent Server Selection Connection Timeout on Server Startup</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="9">Done</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="Ali M">Ali M [X]</reporter>
                        <labels>
                    </labels>
                <created>Wed, 19 Sep 2018 21:37:31 +0000</created>
                <updated>Mon, 11 Feb 2019 20:51:09 +0000</updated>
                            <resolved>Mon, 11 Feb 2019 20:51:09 +0000</resolved>
                                    <version>2.5</version>
                                                    <component>Connectivity</component>
                                        <votes>2</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="2071949" author="ali m" created="Mon, 26 Nov 2018 20:13:39 +0000"  >&lt;p&gt;Thanks Robert. We&apos;re taking a look at updating to 2.7.2. I&apos;ll get back to you soon.&lt;/p&gt;</comment>
                            <comment id="2071729" author="rstam" created="Mon, 26 Nov 2018 18:32:37 +0000"  >&lt;p&gt;The latest 2.7.2 release of the driver has some changes that improve connectivity robustness.&lt;/p&gt;

&lt;p&gt;Can you please try using that version of the driver and report back if you still see this issue? If so we can advise you how to configure the driver to gather more information to help us diagnose the issue.&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|hr8as7:</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>