<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:17:36 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-3288] /bson/oid/init_with_threads failure</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-3288</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;This &lt;a href=&quot;https://evergreen.mongodb.com/task/mongo_c_driver_windows_2015_test_latest_replica_set_noauth_nosasl_nossl_patch_6b9d159ebdb7e93b4b17eeeb4a10dc0e2475996a_5d4b9ede32f4176d1ad0fdae_19_08_08_04_02_50&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;patch build&lt;/a&gt; failed /bson/oid/init_with_threads with the log:&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;C:\data\mci\bb708ee5103729f8b30626f4e56ef44e\mongoc\src\libbson\tests\test-oid.c:71 oid_worker(): precondition failed: 0 &amp;lt; bson_oid_compare (&amp;amp;oid, &amp;amp;oid2)&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;Investigate if this is a transient system issue, a bug in how the test is creating/managing threads, or a possible bug in libbson.&lt;/p&gt;</description>
                <environment></environment>
        <key id="887333">CDRIVER-3288</key>
            <summary>/bson/oid/init_with_threads failure</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="13203">Gone away</resolution>
                                        <assignee username="kevin.albertson@mongodb.com">Kevin Albertson</assignee>
                                    <reporter username="kevin.albertson@mongodb.com">Kevin Albertson</reporter>
                        <labels>
                            <label>flaky-tests</label>
                    </labels>
                <created>Thu, 8 Aug 2019 13:24:36 +0000</created>
                <updated>Fri, 27 Oct 2023 19:50:16 +0000</updated>
                            <resolved>Wed, 27 Sep 2023 18:31:28 +0000</resolved>
                                                                    <component>libbson</component>
                    <component>tests</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="5735467" author="kevin.albertson" created="Wed, 27 Sep 2023 18:31:28 +0000"  >&lt;p&gt;No observed failures from 2023-08-01 to 2023-09-27 for &lt;a href=&quot;https://spruce.mongodb.com/variant-history/mongo-c-driver/sasl-matrix-winssl&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;sasl-matrix-winssl variant&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-4231&quot; title=&quot;Duplicates in ObjectID when inserting in parallel&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-4231&quot;&gt;&lt;del&gt;CDRIVER-4231&lt;/del&gt;&lt;/a&gt; changed ObjectID generation and may have resolved this failure.&lt;/p&gt;

&lt;p&gt;Closing as &quot;Gone away&quot;.&lt;/p&gt;</comment>
                            <comment id="3073959" author="kevin.albertson" created="Thu, 7 May 2020 14:53:11 +0000"  >&lt;p&gt;My hypothesis is that the comparison that ObjectIDs will always increase (when comparing with memcmp) is wrong. The final three bytes of an ObjectID is initialized to a random sequence, and incremented by one on every new ObjectID:&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/specifications/blob/master/source/objectid.rst#specification&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/specifications/blob/master/source/objectid.rst#specification&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If it is randomly initialized at a high value, generating more ObjectIDs may overflow and wrap. If that happens in the same second, then there will be an observed decrease when comparing with memcmp. I think that is expected, and the test should just remove the comparison.&lt;/p&gt;

&lt;p&gt;Though oddly enough, repeatedly running this test for multiple hours on my local mac did not reproduce the issue. I&apos;m not sure if it&apos;s because it&apos;s extremely unlikely, or if my hypothesis is wrong.&lt;/p&gt;

&lt;p&gt;The test generates 500,000 * (N_THREADS=4) = 2,000,000 ObjectIDs. If the sequence is initialized anywhere in  the interval &lt;span class=&quot;error&quot;&gt;&amp;#91;2^24 - 2000000, 2^24&amp;#93;&lt;/span&gt;, then we&apos;d get an overflow assuming the test ran in the same second. Assuming the second was fixed and the generation uniformly random, that should happen with probability:&lt;/p&gt;

&lt;p&gt;(2^24 - 2000000) / 2^24 =  .88&lt;/p&gt;

&lt;p&gt;Looking further at our implementation I&apos;ve noticed two things:&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;      /* We mask off the last nibble so that the last digit of the OID will&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;       * start at zero. Just to be nice. */&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;      context-&amp;gt;seq32 = _get_rand (&amp;amp;seed) &amp;amp; 0x007FFFF0;&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;So the sequence doesn&apos;t start at a completely random value. Though that comment seems a little off. Not only is the last nibble (4 bits) chopped off, but so is the leading bit of the the three byte sequence (It is 7=0111 instead of F=1111).&lt;/p&gt;

&lt;p&gt;When a sequence is applied to a new ObjectID the sequence in the context is converted to big endian to conform to the ObjectID spec. &lt;tt&gt;_bson_context_set_oid_seq32_threadsafe&lt;/tt&gt; currently does this:&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;   int32_t seq = bson_atomic_int_add (&amp;amp;context-&amp;gt;seq32, 1);&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;   seq = BSON_UINT32_TO_BE (seq);&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;   memcpy (&amp;amp;oid-&amp;gt;bytes[9], ((uint8_t *) &amp;amp;seq) + 1, 3);&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;Let&apos;s investigate further to make sure we&apos;re not doing something wrong in our ObjectID generation.&lt;/p&gt;
</comment>
                            <comment id="3073033" author="kevin.albertson" created="Thu, 7 May 2020 00:38:46 +0000"  >&lt;p&gt;Another: &lt;a href=&quot;https://evergreen.mongodb.com/task/mongo_c_driver_windows_2015_test_4.2_server_noauth_sasl_winssl_patch_2fac166210c2449dcc29f97470ffc6fdf9ccf358_5eb343911e2d173c9d30c682_20_05_06_23_09_06&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://evergreen.mongodb.com/task/mongo_c_driver_windows_2015_test_4.2_server_noauth_sasl_winssl_patch_2fac166210c2449dcc29f97470ffc6fdf9ccf358_5eb343911e2d173c9d30c682_20_05_06_23_09_06&lt;/a&gt;&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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>CDRIVER-4108</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hv8fdr:</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>