<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:46:44 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-3943] Problem connect AKS to mongodb</title>
                <link>https://jira.mongodb.org/browse/CSHARP-3943</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;We have application on .Net in Azure AKS. We have connect from CLI with pods, node, VM in this virtual network to private and to public link in Mongodb Atlas, but we can&apos;t connect from application in this pods.&#160;But if we expand the second node, and transfer this pod to the second node, the application works. We turn off the first node and the application does not work. We raise node 1 and transfer it to applications and the application works and connects to the Mongo database.&lt;br/&gt;
If it is not possible to connect to monga, the following messages appear in the logs:&lt;br/&gt;
System.TimeoutException: A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector&lt;/p&gt;
{ AllowedLatencyRange = 00:00:00.0150000 }
&lt;p&gt;, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : &quot;1&quot;, ConnectionMode : &quot;ReplicaSet&quot;, Type : &quot;ReplicaSet&quot;, State : &quot;Disconnected&quot;, Servers : [] }.&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.MongoClient.AreSessionsSupportedAfterServerSelection(CancellationToken cancellationToken)&lt;br/&gt;
at MongoDB.Driver.MongoClient.AreSessionsSupported(CancellationToken cancellationToken)&lt;br/&gt;
at MongoDB.Driver.MongoClient.StartImplicitSession(CancellationToken cancellationToken)&lt;br/&gt;
at MongoDB.Driver.OperationExecutor.StartImplicitSession(CancellationToken cancellationToken)&lt;br/&gt;
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;
at MongoDB.Driver.MongoCollectionImpl`1.Distinct&lt;span class=&quot;error&quot;&gt;&amp;#91;TField&amp;#93;&lt;/span&gt;(FieldDefinition`2 field, FilterDefinition`1 filter, DistinctOptions options, CancellationToken cancellationToken)&lt;br/&gt;
at MongoDB.Driver.IMongoCollectionExtensions.Distinct&lt;span class=&quot;error&quot;&gt;&amp;#91;TDocument,TField&amp;#93;&lt;/span&gt;(IMongoCollection`1 collection, Expression`1 field, FilterDefinition`1 filter, DistinctOptions options, CancellationToken cancellationToken)&lt;/p&gt;</description>
                <environment></environment>
        <key id="1914127">CSHARP-3943</key>
            <summary>Problem connect AKS to mongodb</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="13203">Gone away</resolution>
                                        <assignee username="james.kovacs@mongodb.com">James Kovacs</assignee>
                                    <reporter username="p.shapurau@sdventures.com">Pavel Shapurau</reporter>
                        <labels>
                    </labels>
                <created>Mon, 1 Nov 2021 08:21:21 +0000</created>
                <updated>Fri, 27 Oct 2023 19:56:05 +0000</updated>
                            <resolved>Wed, 17 Nov 2021 12:00:25 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="4194581" author="dbeng-pm-bot" created="Wed, 17 Nov 2021 12:00:27 +0000"  >&lt;p&gt;There hasn&apos;t been any recent activity on this ticket, so we&apos;re resolving it. Thanks for reaching out! Please feel free to comment on this if you&apos;re able to provide more information.&lt;/p&gt;</comment>
                            <comment id="4164596" author="james.kovacs" created="Tue, 2 Nov 2021 18:23:52 +0000"  >&lt;p&gt;Hi, Pavel,&lt;/p&gt;

&lt;p&gt;Thank you for explaining the issue in more detail. Based on your description this is an issue with connecting from AKS to MongoDB Atlas and is not an issue specific to the .NET/C# driver.&lt;/p&gt;

&lt;p&gt;If you are able to connect from other drivers such as our &lt;tt&gt;pymongo&lt;/tt&gt; or Node.js drivers, but not from .NET/C#, that would be an indication of a .NET/C#-specific problem. Note that the legacy &lt;tt&gt;mongo&lt;/tt&gt; shell does not behave exactly as our drivers do in all situations - especially more complex situations such as AKS to Atlas. Our new &lt;tt&gt;mongosh&lt;/tt&gt; shell is built on top of our Node.js driver and is much more representative of how drivers should connect to MongoDB.&lt;/p&gt;

&lt;p&gt;I recommend working with our Atlas Support Team and/or community resources to troubleshoot further. If it is determined that it is a problem specific to the .NET/C# driver, then the .NET/C# team would be able to investigate further with you.&lt;/p&gt;

&lt;p&gt;Sincerely,&lt;br/&gt;
James&lt;/p&gt;</comment>
                            <comment id="4162391" author="JIRAUSER1263121" created="Tue, 2 Nov 2021 07:20:25 +0000"  >&lt;p&gt;Hi, James&lt;/p&gt;

&lt;p&gt;Thanks for your reply.&lt;br/&gt;
I have an AKS node based on the ubuntu 18 image, pods is also based on the ubuntu 18 image. I tried to connect from the command line using the &lt;em&gt;mongo&lt;/em&gt; command line client.&lt;br/&gt;
From my application to the .Net, I can connect to any mongo database at any time. But the Mongo Atlas is not always connected to Mongo database. I conducted an experiment like this:&lt;br/&gt;
I create a new node pool in the AKS cluster and run a container in this node pool - there was a connection to mongo atlas from the application. After that, I changed the node resources in the node pool (I added RAM and CPU) and the connection to the mongo atlas stopped working from my application, in the meantime the application was connected to any other mongo databases at that moment and there is always a connection from the command line, like to mongo atlas and to any other mongo databases.&lt;br/&gt;
I also tried the following actions: I changed the size of my node back to the original resources in the AKS cluster, but the connection from the application to the mongo atlas did not work either. Then I tried the &quot;re-image&quot; option for my node - and it worked! The connection began to work for Mongo Atlas from the application. Thus, by changing the size of the node in the node pool and then clicking the &quot;re-image&quot; option each time, the application connects from this node to the monga atlas. It&apos;s good! But, what happens when the image node is resized and how does this affect the connection of the application from the pod??? And why exactly does not a connection occur to the Mongo atlas after that, while the connection to any other Mongo works correctly? I would like to know the answers to the questions. Because it is not an option every time after changing the size of a node in the AKS cluster, to press the option with hands to &quot;recreate the image&quot; only so that the applications from the pods are connected to the Mongo Atlas. Also, you can do this experiment at home, or we can make a call and I will demonstrate this problem online!&lt;/p&gt;</comment>
                            <comment id="4160949" author="james.kovacs" created="Mon, 1 Nov 2021 16:33:22 +0000"  >&lt;p&gt;Hi, Pavel,&lt;/p&gt;

&lt;p&gt;Thank you for reaching out to us about your connection issue between AKS pods and MongoDB Atlas.&lt;/p&gt;

&lt;p&gt;Based on the stack traces provided, this appears to be an issue with connecting to your MongoDB Atlas replica set from AKS rather than an issue specifically with the MongoDB .NET/C# driver. You mention that you can connect from AKS pods to your MongoDB Atlas replica set using the CLI. Do you mean the old &lt;tt&gt;mongo&lt;/tt&gt; command line client or the newer &lt;tt&gt;mongosh&lt;/tt&gt; command line client? The new &lt;tt&gt;mongosh&lt;/tt&gt; client is built on top of our Node.js driver and is a more accurate reflection of how drivers connect to the cluster.&lt;/p&gt;

&lt;p&gt;Next steps:&lt;br/&gt;
1. Attempt to connect from AKS pod to MongoDB Atlas using &lt;tt&gt;mongosh&lt;/tt&gt; using the &lt;tt&gt;mongodb+srv://&lt;/tt&gt; connection string provided in the Atlas UI.&lt;br/&gt;
2. Attempt to connect from AKS pod to MongoDB Atlas using another driver such as &lt;tt&gt;pymongo&lt;/tt&gt; using the &lt;tt&gt;mongodb+srv://&lt;/tt&gt; connection string provided in the Atlas UI.&lt;/p&gt;

&lt;p&gt;If those fail to connect as well, we suggest troubleshooting further with our MongoDB Atlas Support Team available via &quot;Get Help&quot; in the Atlas UI. If you can connect via both of those methods, then this is more indicative of a problem specific to the .NET/C# driver and we will provide additional troubleshooting steps.&lt;/p&gt;

&lt;p&gt;Sincerely,&lt;br/&gt;
James&lt;/p&gt;</comment>
                            <comment id="4159842" author="JIRAUSER1263121" created="Mon, 1 Nov 2021 09:54:12 +0000"  >&lt;p&gt;Also, the following situation may appear in the log:&lt;br/&gt;
Connection id &quot;0HMCT3BEQJ1BS&quot;, Request id &quot;0HMCT3BEQJ1BS:00000002&quot;: An unhandled exception was thrown by the application.&lt;br/&gt;
System.TimeoutException: A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector&lt;/p&gt;
{ AllowedLatencyRange = 00:00:00.0150000 }
&lt;p&gt;, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : &quot;1&quot;, ConnectionMode : &quot;ReplicaSet&quot;, Type : &quot;ReplicaSet&quot;, State : &quot;Disconnected&quot;, Servers : [] }.&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.WaitForDescriptionChangedAsync(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken)&lt;br/&gt;
at MongoDB.Driver.Core.Clusters.Cluster.SelectServerAsync(IServerSelector selector, CancellationToken cancellationToken)&lt;br/&gt;
at MongoDB.Driver.MongoClient.AreSessionsSupportedAfterServerSelectionAsync(CancellationToken cancellationToken)&lt;br/&gt;
at MongoDB.Driver.MongoClient.AreSessionsSupportedAsync(CancellationToken cancellationToken)&lt;br/&gt;
at MongoDB.Driver.MongoClient.StartImplicitSessionAsync(CancellationToken cancellationToken)&lt;br/&gt;
at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSessionAsync&lt;span class=&quot;error&quot;&gt;&amp;#91;TResult&amp;#93;&lt;/span&gt;(Func`2 funcAsync, CancellationToken cancellationToken)&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|hzrkqf:</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>