<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:42: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-2518] Dns resolver only uses first DNS server.</title>
                <link>https://jira.mongodb.org/browse/CSHARP-2518</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;when connecting, the c# client uses the System.DnsClient.LookupClient to resolve srv records.&lt;/p&gt;

&lt;p&gt;When you have multiple dns servers configured, it only uses the first.&lt;/p&gt;

&lt;p&gt;This is the default behavior of the LookupClient.&lt;/p&gt;

&lt;p&gt;Correct way to do it would be something like:&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;var lookupClient = new LookupClient();&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;foreach (var dnsserver in lookupClient.NameServers)&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;&#160; &#160; var response = lookupClient.Query(&quot;_mongodb._tcp.&quot; + host, QueryType.SRV, QueryClass.IN);&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;&#160; &#160; if (!response.HasError)&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;&#160; &#160; &#160; &#160; break;&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;</description>
                <environment>all</environment>
        <key id="697203">CSHARP-2518</key>
            <summary>Dns resolver only uses first DNS server.</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</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="13201">Fixed</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="basiep">Bas</reporter>
                        <labels>
                            <label>dns</label>
                    </labels>
                <created>Thu, 14 Feb 2019 09:56:37 +0000</created>
                <updated>Sat, 28 Oct 2023 11:48:48 +0000</updated>
                            <resolved>Mon, 19 Apr 2021 17:01:47 +0000</resolved>
                                    <version>2.7.3</version>
                                    <fixVersion>2.10.3</fixVersion>
                                    <component>Connectivity</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="3725563" author="rstam" created="Mon, 19 Apr 2021 17:01:17 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-2968&quot; title=&quot;Exception occurs when using mongodb+srv connection string&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-2968&quot;&gt;&lt;del&gt;CSHARP-2968&lt;/del&gt;&lt;/a&gt; is linked to this ticket because it was while fixing that ticket that we upgraded our dependency on DnsClient from 1.2.0 to 1.3.1.&lt;/p&gt;</comment>
                            <comment id="3725559" author="rstam" created="Mon, 19 Apr 2021 17:00:32 +0000"  >&lt;p&gt;The version of DnsClient we depend on was upgraded on the following dates:&lt;/p&gt;

&lt;p&gt;2021-02-18 Upgraded from 1.3.. to 1.4&lt;/p&gt;

&lt;p&gt;2020-04-03 Upgraded from 1.2.0 to 1.3.1 as part of work on &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-2968&quot; title=&quot;Exception occurs when using mongodb+srv connection string&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-2968&quot;&gt;&lt;del&gt;CSHARP-2968&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-2968&quot; title=&quot;Exception occurs when using mongodb+srv connection string&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-2968&quot;&gt;&lt;del&gt;CSHARP-2968&lt;/del&gt;&lt;/a&gt; has a fix version of 2.10.3 I am going to give this ticket the same fix version.&lt;/p&gt;</comment>
                            <comment id="3704589" author="rstam" created="Wed, 7 Apr 2021 03:20:06 +0000"  >&lt;p&gt;DnsClient issue 64 states that starting with version 1.3 the LookupClient.Query method will try all available DNS servers.&lt;/p&gt;

&lt;p&gt;Looking at the DnsClient source code confirms this:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/MichaCo/DnsClient.NET/blob/dev/src/DnsClient/LookupClient.cs#L764&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/MichaCo/DnsClient.NET/blob/dev/src/DnsClient/LookupClient.cs#L764&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We use DnsClient version1.4, so the version we use includes this feature.&lt;/p&gt;

&lt;p&gt;I think we can close this as Fixed (i.e. the issue was fixed by upgrading to a newer version of DnsClient).&lt;/p&gt;</comment>
                            <comment id="2979642" author="kletterer@web.de" created="Sat, 14 Mar 2020 01:32:09 +0000"  >&lt;p&gt;I decided to add another feature to DnsClient which will allow LookupClient to query other configured servers in case the response doesn&apos;t have an answer for the question, if there are more than one servers resolved/configured.&lt;/p&gt;

&lt;p&gt;See&#160;&lt;a href=&quot;https://github.com/MichaCo/DnsClient.NET/issues/64&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/MichaCo/DnsClient.NET/issues/64&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Not sure if this will resolve this issue, but maybe you could give it a try and let me know&lt;/p&gt;</comment>
                            <comment id="2969573" author="kletterer@web.de" created="Thu, 12 Mar 2020 01:37:35 +0000"  >&lt;p&gt;Hi,&#160;&lt;/p&gt;

&lt;p&gt;Although that issue is already a bit old, I&apos;d still like to clarify a couple things.&lt;/p&gt;

&lt;p&gt;If multiple servers are configured in DnsClient it will try to get a response trying the servers in random order (in 1.3.0 the order will be &quot;more&quot; random btw. ^^), unless the client is configured to always use the servers in order.&lt;/p&gt;

&lt;p&gt;In general, the assumption of the client is that all your DNS servers return the same result. And if the server returns a valid response, there is no need to spam the network with more requests.&lt;/p&gt;

&lt;p&gt;If the response does have an error code though, it WILL ask every server until it gets a response without an error code or runs out of servers.&lt;br/&gt;
 Possible error codes are here:&#160;&lt;a href=&quot;https://tools.ietf.org/html/rfc6895#section-2.3&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://tools.ietf.org/html/rfc6895#section-2.3&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I&apos;m not sure @Bas what error you exactly got back from the client, &quot;could not resolve host&quot; is not an error coming from LookupClient - that text doesn&apos;t exist in my source at least.&lt;/p&gt;

&lt;p&gt;Version 1.3.0 will have a little bit better error handling and also some logging feature. So, if you still have issues with that, try that version and post the Trace outputs, that could help.&lt;/p&gt;

&lt;p&gt;But, in general, the safest way would be to only use the DNS server you want to use instead of having DnsClient guess what it should use to resolve questions.&lt;br/&gt;
 When instantiating LookupClient without any specific servers, it will try to iterate all network adapters to find any DNS servers.&#160;&lt;/p&gt;

&lt;p&gt;You can pass one or more NameServers when instantiating LookupClient, that would be the safest way...&#160;As far as I can tell that&apos;s not an option provided by the driver though.&lt;/p&gt;

&lt;p&gt;&#160;Also, feel free to suggest changes/improvements on the DnsClient github repo&lt;/p&gt;</comment>
                            <comment id="2171665" author="rstam" created="Tue, 5 Mar 2019 20:29:31 +0000"  >&lt;p&gt;I&apos;m a little surprised that DnsClient doesn&apos;t handle this scenario correctly.&lt;/p&gt;

&lt;p&gt;I&apos;ve changed the status of the ticket from Investigating to Open so that it can be scheduled for a future release.&lt;/p&gt;</comment>
                            <comment id="2171662" author="rstam" created="Tue, 5 Mar 2019 20:26:53 +0000"  >&lt;p&gt;Thanks for the additional information on why different name servers could legitimately return different responses. That is very helpful.&lt;/p&gt;

&lt;p&gt;Regarding DnsClient trying the name servers one by one in order, that is apparently the actual implementation when LookupClient UseRandomNameServer is true (so not actually so random after all). That would explain the behavior you are seeing when calling Query 3 times in a row.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="2171640" author="basiep" created="Tue, 5 Mar 2019 20:14:26 +0000"  >&lt;p&gt;no i got an &apos;could not resolve host&apos; error from the lookupclient. It is a normal response, but without an ip adres..&lt;/p&gt;

&lt;p&gt;Calling it again gave me a response, after investigating i noticed that the first response contained the used dns server. It was my primary, the second response had my second dns server.&lt;br/&gt;
 Calling it 3 times resulted in 1st, 2nd, and 1st again.. and so on..&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;I&apos;m confused, if one name server returns &apos;not found&apos; wouldn&apos;t the next name server return the same result? Are the name servers misconfigured?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;no, if you use vpn, and only route specific routes trought the vpn, you need to be able to resolve both on vpn (with their local dns server) and the internet (with your own dns server)&lt;/p&gt;

&lt;p&gt;In cases like that you have 2 active dns servers. But there are other scenario&apos;s. The whole reason you can (and most of use do) configure more then 1 dns server is for cases like this, but also, because dns servers don&apos;t actively query the internet. They know only their neighbors.&lt;/p&gt;

&lt;p&gt;See also these links:&lt;br/&gt;
&lt;a href=&quot;https://superuser.com/questions/187046/why-does-ipconfig-show-multiple-dns-servers&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://superuser.com/questions/187046/why-does-ipconfig-show-multiple-dns-servers&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;https://www.quora.com/Why-are-there-two-DNS-servers-primary-and-secondary&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://www.quora.com/Why-are-there-two-DNS-servers-primary-and-secondary&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="2171615" author="rstam" created="Tue, 5 Mar 2019 19:57:35 +0000"  >&lt;p&gt;Thanks for the additional information in your edited changes to your previous comment.&lt;/p&gt;

&lt;p&gt;I&apos;m confused, if one name server returns &apos;not found&apos; wouldn&apos;t the next name server return the same result? Are the name servers misconfigured?&lt;/p&gt;</comment>
                            <comment id="2171392" author="rstam" created="Tue, 5 Mar 2019 18:07:51 +0000"  >&lt;p&gt;So what problem exactly did you encounter that you are attempting to address?&lt;/p&gt;

&lt;p&gt;Did you get an exception? Do you have a stack trace?&lt;/p&gt;</comment>
                            <comment id="2171376" author="basiep" created="Tue, 5 Mar 2019 18:01:21 +0000"  >&lt;p&gt;did you try it? cause I did..&lt;/p&gt;

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

&lt;p&gt;Also the problem is not with retrying, it got a result back from the first nameserver. The problem is that the first nameserver returns a &apos;not found&apos; back.&lt;/p&gt;

&lt;p&gt;Any networking protocol (ping in example) then tries the next nameserver.. Mongo doesn&apos;t.&lt;/p&gt;</comment>
                            <comment id="2171057" author="rstam" created="Tue, 5 Mar 2019 15:16:51 +0000"  >&lt;p&gt;I don&apos;t think DnsClient works the way you think it does.&lt;/p&gt;

&lt;p&gt;As far as I can tell by looking at the source code the implementation of Query already has retry logic and will attempt to use all configured name servers.&lt;/p&gt;</comment>
                            <comment id="2170700" author="basiep" created="Tue, 5 Mar 2019 11:05:52 +0000"  >&lt;p&gt;that&apos;s how the lookup client works.. you should dive into it..&lt;/p&gt;

&lt;p&gt;the first dns request you do, goes to your first dns server, if i then do the command in the loop again (same command, same parameters) it resolves using the second dns server.&lt;br/&gt;
Do it again, it tries the first again. (if you have 2; if you have 3, it goes to the 3th)&lt;/p&gt;

&lt;p&gt;I itterate the list just to make sure i query all the dns servers, and no, i don&apos;t use the value&lt;/p&gt;</comment>
                            <comment id="2162128" author="ian@10gen.com" created="Mon, 25 Feb 2019 20:24:10 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=basiep&quot; class=&quot;user-hover&quot; rel=&quot;basiep&quot;&gt;basiep&lt;/a&gt;: your sample for-loop doesn&apos;t actually use&#160;&lt;tt&gt;dnsserver&lt;/tt&gt;. Did you intend something else?&lt;/p&gt;</comment>
                            <comment id="2153365" author="jeff.yemin" created="Fri, 15 Feb 2019 16:20:17 +0000"  >&lt;p&gt;But please note that we are currently changing this code pretty radically in scope of &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-2430&quot; title=&quot;Support polling SRV records for mongos discovery&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-2430&quot;&gt;&lt;del&gt;CSHARP-2430&lt;/del&gt;&lt;/a&gt;, so it may be best to hold off for a bit.&lt;/p&gt;</comment>
                            <comment id="2153363" author="jeff.yemin" created="Fri, 15 Feb 2019 16:19:13 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=basiep&quot; class=&quot;user-hover&quot; rel=&quot;basiep&quot;&gt;basiep&lt;/a&gt;,&lt;/p&gt;

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

&lt;p&gt;Thanks for volunteering to submit a pull request.&#160; Instructions for creating one can be found at &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/blob/master/CONTRIBUTING.md&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/blob/master/CONTRIBUTING.md&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Regards,&lt;br/&gt;
Jeff&lt;/p&gt;</comment>
                            <comment id="2153360" author="basiep" created="Fri, 15 Feb 2019 16:15:06 +0000"  >&lt;p&gt;Anyone even active here?&lt;/p&gt;

&lt;p&gt;I can create a pull-request if you like?&lt;/p&gt;</comment>
                            <comment id="2148658" author="basiep" created="Thu, 14 Feb 2019 10:00:13 +0000"  >&lt;p&gt;is there a way to create a pullrequest&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1149269">CSHARP-2968</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2284097">PYTHON-3630</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <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|hudayn:</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>