<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:19:43 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>[CDRIVER-4028] Wrong error message printed when DNS resolution fails</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-4028</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;While investigating HELP-25377, I noticed that &lt;tt&gt;_mongoc_get_rr_search&lt;/tt&gt; uses &lt;tt&gt;strerror&lt;/tt&gt; to print an error message from &lt;tt&gt;h_errno&lt;/tt&gt;. The latter is set when an error occurs in the &lt;tt&gt;res_nsearch&lt;/tt&gt; or &lt;tt&gt;res_search&lt;/tt&gt; calls earlier. However, &lt;tt&gt;h_errno&lt;/tt&gt; is not designed to be run through &lt;tt&gt;strerror&lt;/tt&gt;, and the actual error is different from what we see in the error message. In HELP-25377 in particular, the error message seen was &quot;Interrupted system call&quot;. We can see its mapping:&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;   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;#define	EINTR		 4	/* Interrupted system call */&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;Looking at the error section for &lt;a href=&quot;https://linux.die.net/man/3/h_errno&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;h_errno in the manual&lt;/a&gt;, this is not at all what&apos;s happening:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Errors&lt;/p&gt;

&lt;p&gt;The variable h_errno can have the following values:&lt;/p&gt;

&lt;p&gt;HOST_NOT_FOUND&lt;br/&gt;
The specified host is unknown.&lt;br/&gt;
NO_ADDRESS or NO_DATA&lt;br/&gt;
The requested name is valid but does not have an IP address.&lt;br/&gt;
NO_RECOVERY&lt;br/&gt;
A nonrecoverable name server error occurred.&lt;br/&gt;
TRY_AGAIN&lt;br/&gt;
A temporary error occurred on an authoritative name server. Try again later.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;h_errno.h also defines &lt;tt&gt;hstrerror&lt;/tt&gt; to retrieve the error string for a given error code, but this has been marked obsolete. With that in mind, I&apos;d suggest adding &lt;tt&gt;_mongoc_hstrerror&lt;/tt&gt; to get an error string for an error, taken from the list above.&lt;/p&gt;

&lt;p&gt;I&apos;ll note that whether on purpose or by oversight, the function also ignores the &lt;tt&gt;TRY_AGAIN&lt;/tt&gt; error. One could argue that &quot;Try again later&quot; does not suggest retrying the lookup right away, and it also wouldn&apos;t have fixed the problem in HELP-25377 as &lt;tt&gt;h_errno&lt;/tt&gt; is set to &lt;tt&gt;NO_DATA&lt;/tt&gt;. However, it might be beneficial to try again to protect against transient failures.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1789575">CDRIVER-4028</key>
            <summary>Wrong error message printed when DNS resolution fails</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="13201">Fixed</resolution>
                                        <assignee username="andreas.braun@mongodb.com">Andreas Braun</assignee>
                                    <reporter username="andreas.braun@mongodb.com">Andreas Braun</reporter>
                        <labels>
                    </labels>
                <created>Fri, 18 Jun 2021 12:19:29 +0000</created>
                <updated>Sat, 28 Oct 2023 11:28:27 +0000</updated>
                            <resolved>Thu, 1 Jul 2021 07:06:17 +0000</resolved>
                                                    <fixVersion>1.17.7</fixVersion>
                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="3911550" author="xgen-internal-githook" created="Thu, 1 Jul 2021 07:05:34 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Andreas Braun&apos;, &apos;email&apos;: &apos;alcaeus@users.noreply.github.com&apos;, &apos;username&apos;: &apos;alcaeus&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-4028&quot; title=&quot;Wrong error message printed when DNS resolution fails&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-4028&quot;&gt;&lt;del&gt;CDRIVER-4028&lt;/del&gt;&lt;/a&gt; Print correct error message when DNS resolution fails (#811)&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Print correct error message when DNS resolution fails&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;Drop duplicate case value&lt;br/&gt;
Branch: r1.17&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/e1be09a091c295c60599002b25cb79c673a714f7&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/e1be09a091c295c60599002b25cb79c673a714f7&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="3911547" author="xgen-internal-githook" created="Thu, 1 Jul 2021 07:00:53 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Andreas Braun&apos;, &apos;email&apos;: &apos;alcaeus@users.noreply.github.com&apos;, &apos;username&apos;: &apos;alcaeus&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-4028&quot; title=&quot;Wrong error message printed when DNS resolution fails&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-4028&quot;&gt;&lt;del&gt;CDRIVER-4028&lt;/del&gt;&lt;/a&gt; Print correct error message when DNS resolution fails (#811)&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Print correct error message when DNS resolution fails&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;Drop duplicate case value&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/e37552db90888d87a909ed84cb6bb707c06be34e&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/e37552db90888d87a909ed84cb6bb707c06be34e&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="3907963" author="jmikola@gmail.com" created="Tue, 29 Jun 2021 16:13:54 +0000"  >&lt;blockquote&gt;&lt;p&gt;h_errno.h also defines hstrerror to retrieve the error string for a given error code, but this has been marked obsolete&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Quoting &lt;a href=&quot;https://stackoverflow.com/a/11832735&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;this Stack Overflow discussion&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;They are obsolete because gethostbyname* is obsolete. Use getaddrinfo instead, and use gai_strerror for errors. From the &lt;a href=&quot;http://linux.die.net/man/3/gethostbyname&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;gethostbyname(3) man page&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;The gethostbyname*() and gethostbyaddr*() functions are obsolete. Applications should use getaddrinfo(3) and getnameinfo(3) instead.&lt;/p&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;

&lt;p&gt;I realize the context here pertains to SRV resolution and we aren&apos;t using &lt;tt&gt;gethostbyname&lt;/tt&gt; directly.&lt;/p&gt;

&lt;p&gt;Of the various APIs we use for DNS here, &lt;tt&gt;h_errno&lt;/tt&gt; is only mentioned in &lt;a href=&quot;https://man7.org/linux/man-pages/man3/resolver.3.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;resolver(3)&lt;/a&gt;. I belive that corresponds to &lt;tt&gt;MONGOC_HAVE_RES_NSEARCH&lt;/tt&gt;. I didn&apos;t find any reference to &lt;tt&gt;h_errno&lt;/tt&gt; from the APIs used for &lt;tt&gt;MONGOC_HAVE_RES_SEARCH&lt;/tt&gt; (e.g. &lt;a href=&quot;https://linux.die.net/man/3/res_search&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;res_search(3)&lt;/a&gt;; however, those do refer to &lt;a href=&quot;https://linux.die.net/man/3/gethostbyname&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;gethostbyname(3)&lt;/a&gt; so I presume they also set &lt;tt&gt;h_errno&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;More generally, I wonder if there&apos;s a newer API for DNS resolution (perhaps related to &lt;tt&gt;getaddrinfo&lt;/tt&gt;) that we should consider using.&lt;/p&gt;</comment>
                            <comment id="3907123" author="andreas.braun" created="Tue, 29 Jun 2021 11:58:41 +0000"  >&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/pull/811&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/pull/811&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="1954423">CDRIVER-4249</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </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|hz7snj:</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>