<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:41:34 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-2086] Inconsistent MongoClient Connection Behavior- Timeout depending upon connection setup</title>
                <link>https://jira.mongodb.org/browse/CSHARP-2086</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;So I have a long running Windows Service that is performing a few dozen tasks each of which read/write to two different mongo servers (one being a 3 member replica set and the other being a single member replica set).&lt;/p&gt;

&lt;p&gt;The MongoClients for all processes are being handled by a Singleton.   This has been up and running for a year+ with no issues using the following code to acquire a MongoClient.&lt;/p&gt;

&lt;p&gt;```&lt;br/&gt;
_client = new MongoClient(connstring);&lt;br/&gt;
```&lt;br/&gt;
Simple Enough.&lt;br/&gt;
Now we wanted to try and get some analytics for the queries and changed it to the following;&lt;/p&gt;

&lt;p&gt;```&lt;br/&gt;
Action&amp;lt;string, DateTime, TimeSpan, bool&amp;gt; _trackIt = null;&lt;br/&gt;
var mongoUrl = new MongoUrl(connstring);&lt;br/&gt;
                        var mongoClientSettings = MongoClientSettings.FromUrl(mongoUrl);&lt;br/&gt;
                        mongoClientSettings.ClusterConfigurator = clusterConfigurator =&amp;gt;&lt;br/&gt;
                        {&lt;br/&gt;
                            if (_trackIt != null) &lt;/p&gt;
{
                                //Code Here for profiling that is never called
                            }
&lt;p&gt;                        };&lt;/p&gt;

&lt;p&gt;                        _client = new MongoClient(mongoClientSettings);&lt;br/&gt;
```&lt;/p&gt;

&lt;p&gt;Now with the Example above the Action used for tracking is in fact null as this process isn&apos;t collecting any analytics on performance.  &lt;br/&gt;
I would expect this to perform the same but after a couple of hours of running the tasks without an issue we start getting the following error and have to constantly re-start the service.&lt;/p&gt;

&lt;p&gt;```&lt;br/&gt;
System.TimeoutException: A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = WritableServerSelector, LatencyLimitingServerSelector&lt;/p&gt;
{ AllowedLatencyRange = 00:00:00.0150000 }
&lt;p&gt; }. Client view of cluster state is { ClusterId : &quot;8536&quot;, ConnectionMode : &quot;Automatic&quot;, Type : &quot;Unknown&quot;, State : &quot;Disconnected&quot;, Servers : [{ ServerId: &quot;&lt;/p&gt;
{ ClusterId : 8536, EndPoint : &quot;Unspecified/someserver.in.datacenter.com:27017&quot; }
&lt;p&gt;&quot;, EndPoint: &quot;Unspecified/someserver.in.datacenter.com:27017&quot;, State: &quot;Disconnected&quot;, Type: &quot;Unknown&quot; }] }.&lt;br/&gt;
   at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description)&lt;br/&gt;
   at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedHelper.HandleCompletedTask(Task completedTask)&lt;br/&gt;
   at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChanged(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken)&lt;br/&gt;
   at MongoDB.Driver.Core.Clusters.Cluster.SelectServer(IServerSelector selector, CancellationToken cancellationToken)&lt;br/&gt;
   at MongoDB.Driver.Core.Bindings.WritableServerBinding.GetWriteChannelSource(CancellationToken cancellationToken)&lt;br/&gt;
   at MongoDB.Driver.Core.Operations.FindAndModifyOperationBase`1.Execute(IWriteBinding binding, CancellationToken cancellationToken)&lt;br/&gt;
   at MongoDB.Driver.OperationExecutor.ExecuteWriteOperation&lt;span class=&quot;error&quot;&gt;&amp;#91;TResult&amp;#93;&lt;/span&gt;(IWriteBinding binding, IWriteOperation`1 operation, CancellationToken cancellationToken)&lt;br/&gt;
   at MongoDB.Driver.MongoCollectionImpl`1.ExecuteWriteOperation&lt;span class=&quot;error&quot;&gt;&amp;#91;TResult&amp;#93;&lt;/span&gt;(IWriteOperation`1 operation, CancellationToken cancellationToken)&lt;br/&gt;
   at MongoDB.Driver.MongoCollectionImpl`1.FindOneAndUpdate&lt;span class=&quot;error&quot;&gt;&amp;#91;TProjection&amp;#93;&lt;/span&gt;(FilterDefinition`1 filter, UpdateDefinition`1 update, FindOneAndUpdateOptions`2 options, CancellationToken cancellationToken)&lt;br/&gt;
```&lt;/p&gt;

&lt;p&gt;We get the error for both servers each erroring out independently.  No changes are made to the connection string between the failing and error-less execution path.&lt;/p&gt;</description>
                <environment>.Net Full,  Windows Server 2012</environment>
        <key id="453812">CSHARP-2086</key>
            <summary>Inconsistent MongoClient Connection Behavior- Timeout depending upon connection setup</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="-1">Unassigned</assignee>
                                    <reporter username="bret@cityspark.com">Bret Ferrier</reporter>
                        <labels>
                    </labels>
                <created>Wed, 1 Nov 2017 16:49:40 +0000</created>
                <updated>Wed, 9 Feb 2022 01:35:45 +0000</updated>
                            <resolved>Wed, 9 Feb 2022 01:35:45 +0000</resolved>
                                    <version>2.4.4</version>
                                                    <component>Connectivity</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="4344071" author="james.kovacs" created="Wed, 9 Feb 2022 01:35:27 +0000"  >&lt;p&gt;&lt;tt&gt;ClusterConfigurator&lt;/tt&gt; defines an &lt;tt&gt;Action&amp;lt;ClusterBuilder&amp;gt;&lt;/tt&gt; delegate to run when a new cluster is created. If the delegate does not execute any code, then it cannot modify the default cluster configuration and thus cannot impact cluster connectivity.&lt;/p&gt;

&lt;p&gt;If you encounter a similar issue in the future, we encourage you to reach out to the following channels to help diagnose the issue:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Our MongoDB support portal, located at &lt;a href=&quot;https://support.mongodb.com/welcome&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;support.mongodb.com&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;Our MongoDB community portal, located &lt;a href=&quot;https://developer.mongodb.com/community/forums/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;If you are an Atlas customer, you can review your support options by clicking Support in the top menu bar of the Atlas UI&lt;/li&gt;
&lt;/ul&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|htaxwn:</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>