<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:19: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>[CDRIVER-3928] Error code 0 is rewritten to 17 when checking command responses</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-3928</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3885&quot; title=&quot;Drivers should not inspect error messages for &amp;quot;not master&amp;quot; or &amp;quot;node is recovering&amp;quot;&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3885&quot;&gt;&lt;del&gt;CDRIVER-3885&lt;/del&gt;&lt;/a&gt; requires drivers making a distinction between command error responses returning an error code and those not providing one. While implementing this, I noticed that error code 0 is automatically changed to &lt;tt&gt;MONGO_ERR_QUERY_FAILURE&lt;/tt&gt; (17). Quoting from the pull request (&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/pull/745#discussion_r590448768&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;link to comment&lt;/a&gt;):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;tt&gt;_mongoc_cmd_check_ok&lt;/tt&gt; and &lt;tt&gt;_mongoc_cmd_check_ok_no_wce&lt;/tt&gt; rely on &lt;tt&gt;_parse_error_reply&lt;/tt&gt; to extract message and code information from a bson_t reply. If no code is found in the reply document, a code of 0 is returned.&lt;/p&gt;

&lt;p&gt;The two check methods then take this information and build a &lt;tt&gt;bson_error_t&lt;/tt&gt; of it, but only after changing the error code to &lt;tt&gt;MONGOC_ERROR_QUERY_FAILURE&lt;/tt&gt; (17) if it was 0, essentially defaulting to that error code. &lt;tt&gt;_mongoc_cmd_check_ok_no_wce&lt;/tt&gt; and &lt;tt&gt;_mongoc_cmd_check_ok&lt;/tt&gt; should not change the error code, but instead this logic should be moved to wherever the &lt;tt&gt;MONGOC_ERROR_QUERY_FAILURE&lt;/tt&gt; is needed.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=clyde.bazile&quot; class=&quot;user-hover&quot; rel=&quot;clyde.bazile&quot;&gt;clyde.bazile&lt;/a&gt; pointed out that other code may assume an error code 0 to mean that everything was successful, so this will have to be covered. A viable strategy may be to expand &lt;tt&gt;bson_error_t&lt;/tt&gt; to expose if an error code was given. The &lt;tt&gt;code&lt;/tt&gt; field in that struct is declared as &lt;tt&gt;uint32_t&lt;/tt&gt;, so we can&apos;t use -1 to show that no code was provided. Adding a &lt;tt&gt;has_code&lt;/tt&gt; field to &lt;tt&gt;bson_error_t&lt;/tt&gt; would work, but this may cause unwanted side effects in public APIs to cover this.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1646489">CDRIVER-3928</key>
            <summary>Error code 0 is rewritten to 17 when checking command responses</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="andreas.braun@mongodb.com">Andreas Braun</reporter>
                        <labels>
                    </labels>
                <created>Thu, 11 Mar 2021 08:17:30 +0000</created>
                <updated>Fri, 10 Feb 2023 16:15:06 +0000</updated>
                                                                                                <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                        <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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>CDRIVER-4576</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hykben:</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>