<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:16:10 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-2734] maxTimeMS command option should be appended as int64 instead of int32</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-2734</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;Quoting my &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1329?focusedCommentId=1943532&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-1943532&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;comment from CDRIVER-1329&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;tt&gt;mongoc_find_and_modify_opts_set_max_time_ms()&lt;/tt&gt; accepts a &lt;tt&gt;uint32_t&lt;/tt&gt; and the options struct internally tracks &lt;tt&gt;max_time_ms&lt;/tt&gt; as &lt;tt&gt;uint32_t&lt;/tt&gt;. In &lt;tt&gt;mongoc_collection_find_and_modify_with_opts()&lt;/tt&gt;, the value is appended with &lt;tt&gt;BSON_APPEND_INT32&lt;/tt&gt;. We should be able to cast the value as an &lt;tt&gt;int64_t&lt;/tt&gt; and append as a 64-bit BSON integer, which would remove the risk of &lt;tt&gt;UINT32_MAX&lt;/tt&gt; turning into &lt;tt&gt;INT32_MIN&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;Similarly, &lt;tt&gt;mongoc_cursor_set_max_await_time_ms()&lt;/tt&gt; and &lt;tt&gt;mongoc_cursor_get_max_await_time_ms()&lt;/tt&gt; use &lt;tt&gt;uint32_t&lt;/tt&gt; but store the value as an int64 in the cursor&apos;s options &lt;tt&gt;bson_t&lt;/tt&gt;. This effectively limits the value to &lt;tt&gt;UINT32_MAX&lt;/tt&gt;. However, users could theoretically pass a larger non-negative 64-bit integer as &quot;maxAwaitTimeMS&quot; via the find options and ignore the getter&apos;s limitation. That said, we still have a problem in &lt;tt&gt;&lt;em&gt;mongoc_cursor_prepare_getmore_command()&lt;/tt&gt;, as it uses the getter (which will cast down the original &lt;tt&gt;int64_t&lt;/tt&gt;) and _also&lt;/em&gt; uses &lt;tt&gt;bson_append_int32&lt;/tt&gt; to append, which also carries the risk of &lt;tt&gt;UINT32_MAX&lt;/tt&gt; turning into &lt;tt&gt;INT32_MIN&lt;/tt&gt;.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Correcting the usage of &lt;tt&gt;uint32_t&lt;/tt&gt; will break ABI (hence &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1329&quot; title=&quot;maxTimeMS and maxAwaitTimeMS should be Int64, not Int32&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-1329&quot;&gt;CDRIVER-1329&lt;/a&gt; targeting 2.0) but we should be able to fix the internal appending behavior.&lt;/p&gt;

&lt;p&gt;If users of &lt;tt&gt;mongoc_collection_find_and_modify_with_opts()&lt;/tt&gt; need to specify a larger &quot;maxTimeMS&quot; value, they can add it directly to the extra opts &lt;tt&gt;bson_t&lt;/tt&gt; and avoid using &lt;tt&gt;mongoc_find_and_modify_opts_set_max_time_ms()&lt;/tt&gt; altogether.&lt;/p&gt;

&lt;p&gt;There is no limitation with &lt;tt&gt;mongoc_collection_find_with_opts()&lt;/tt&gt; supporting large &quot;maxTimeMS&quot; values since users supply their own &lt;tt&gt;bson_t&lt;/tt&gt; for options. &quot;maxAwaitTimeMS&quot; will be limited to &lt;tt&gt;uint32_t&lt;/tt&gt; since it is set via a function after the cursor is created, so the documentation should likely be updated to note this limitation. That said, &lt;tt&gt;UINT32_MAX&lt;/tt&gt; should be sufficient for all practical use cases.&lt;/p&gt;</description>
                <environment></environment>
        <key id="569924">CDRIVER-2734</key>
            <summary>maxTimeMS command option should be appended as int64 instead of int32</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="evgeni.dobranov@mongodb.com">Evgeni Dobranov</assignee>
                                    <reporter username="jmikola@mongodb.com">Jeremy Mikola</reporter>
                        <labels>
                            <label>documentation-needed</label>
                    </labels>
                <created>Tue, 10 Jul 2018 19:00:25 +0000</created>
                <updated>Sat, 28 Oct 2023 11:29:44 +0000</updated>
                            <resolved>Thu, 26 Jul 2018 20:28:17 +0000</resolved>
                                                    <fixVersion>1.13.0</fixVersion>
                                    <component>libmongoc</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1957897" author="xgen-internal-githook" created="Thu, 26 Jul 2018 20:26:54 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;edobranov&apos;, &apos;name&apos;: &apos;Evgeni Dobranov&apos;, &apos;email&apos;: &apos;evobranov@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2734&quot; title=&quot;maxTimeMS command option should be appended as int64 instead of int32&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2734&quot;&gt;&lt;del&gt;CDRIVER-2734&lt;/del&gt;&lt;/a&gt; use in64_t in cursor_next await time&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/f9b862db887f883a2ccb0ff89837b9d2f273ed46&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/f9b862db887f883a2ccb0ff89837b9d2f273ed46&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="294103">CDRIVER-1329</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|htt3g7:</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>