<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:19:33 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-3969] Destruction of cursor leads to failed bson assert of the cursor server_id</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-3969</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;I encountered an issue where the &lt;tt&gt;mongoc_cursor_destroy&lt;/tt&gt; function is not able to destroy a cursor. I attached a file with a small c program that demonstrates the issue. You need to replace the uri_string, db_name &amp;amp; collection_name so they are valid for your system. The issue only occurs when the collection has more than 100 elements.&lt;/p&gt;

&lt;p&gt;The crucial part in the attached c program is the following:&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;mongoc_client_command_with_opts(client, db_name, command, NULL, NULL, &amp;amp;reply, &amp;amp;error);&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;cursor = mongoc_cursor_new_from_command_reply_with_opts(client, &amp;amp;reply, NULL);&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;mongoc_cursor_destroy(cursor);&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;&#160;&lt;/p&gt;

&lt;p&gt;The cursor returned from &lt;tt&gt;mongoc_cursor_new_from_command_reply_with_opts&lt;/tt&gt; has a non zero cursor_id and a server_id which is zero.&lt;/p&gt;

&lt;p&gt;This leads to the failure of &lt;tt&gt;BSON_ASSERT(server_id)&lt;/tt&gt; during the destruction of the cursor inside &lt;tt&gt;mongoc_cluster_stream_for_server()&lt;/tt&gt; in &lt;tt&gt;mongoc-cluster.c&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;The log output is the following:&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;/build/mongo-c-driver-RRvvb_/mongo-c-driver-1.16.1/src/libmongoc/src/mongoc/mongoc-cluster.c:1913 mongoc_cluster_stream_for_server(): precondition failed: server_id&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;Aborted&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>Windows 10 with mongoc driver 1.75.5&lt;br/&gt;
Ubuntu 20.04.2 LTS with mongoc driver 1.16.1 (inside Windows Subsystem for Linux 2)&lt;br/&gt;
</environment>
        <key id="1695834">CDRIVER-3969</key>
            <summary>Destruction of cursor leads to failed bson assert of the cursor server_id</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="kevin.albertson@mongodb.com">Kevin Albertson</assignee>
                                    <reporter username="johannes.schulte@inmation.com">Johannes Schulte</reporter>
                        <labels>
                            <label>rp-toSched</label>
                            <label>size-small</label>
                    </labels>
                <created>Thu, 29 Apr 2021 10:48:20 +0000</created>
                <updated>Sat, 28 Oct 2023 11:28:29 +0000</updated>
                            <resolved>Mon, 26 Jun 2023 18:11:43 +0000</resolved>
                                    <version>1.16.1</version>
                    <version>1.17.5</version>
                                    <fixVersion>1.24.2</fixVersion>
                                    <component>libmongoc</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="5558684" author="xgen-internal-githook" created="Tue, 11 Jul 2023 20:17:02 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Kevin Albertson&apos;, &apos;email&apos;: &apos;kevin.albertson@mongodb.com&apos;, &apos;username&apos;: &apos;kevinAlbs&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3969&quot; title=&quot;Destruction of cursor leads to failed bson assert of the cursor server_id&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3969&quot;&gt;&lt;del&gt;CDRIVER-3969&lt;/del&gt;&lt;/a&gt; set serverId with mocked cursor reply (#1335)&lt;/p&gt;

&lt;p&gt;serverId is expected in mongoc_cursor_new_from_command_reply_with_opts&lt;br/&gt;
when the reply includes a non-zero cursor.id&lt;br/&gt;
Branch: r1.24&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/e167ae7d5f67b7cb2a8690890c7734df4463e491&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/e167ae7d5f67b7cb2a8690890c7734df4463e491&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5541670" author="xgen-internal-githook" created="Mon, 3 Jul 2023 23:55:42 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Kevin Albertson&apos;, &apos;email&apos;: &apos;kevin.albertson@mongodb.com&apos;, &apos;username&apos;: &apos;kevinAlbs&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3969&quot; title=&quot;Destruction of cursor leads to failed bson assert of the cursor server_id&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3969&quot;&gt;&lt;del&gt;CDRIVER-3969&lt;/del&gt;&lt;/a&gt; set serverId with mocked cursor reply (#1335)&lt;/p&gt;

&lt;p&gt;serverId is expected in mongoc_cursor_new_from_command_reply_with_opts&lt;br/&gt;
when the reply includes a non-zero cursor.id&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/9e7bf882d1fb4e16f5701a152f5c664088ffcda3&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/9e7bf882d1fb4e16f5701a152f5c664088ffcda3&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5525624" author="xgen-internal-githook" created="Mon, 26 Jun 2023 18:13:17 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Kevin Albertson&apos;, &apos;email&apos;: &apos;kevin.albertson@mongodb.com&apos;, &apos;username&apos;: &apos;kevinAlbs&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3969&quot; title=&quot;Destruction of cursor leads to failed bson assert of the cursor server_id&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3969&quot;&gt;&lt;del&gt;CDRIVER-3969&lt;/del&gt;&lt;/a&gt; error when creating uncompleted cursor with no server ID (#1321)&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;fix type of BCON_INT32 value&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;require serverID for open cursor with `mongoc_cursor_new_from_command_reply_with_opts`&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;document expectations of server ID option&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;assert `found` after `mongoc_cursor_error`&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;If an error occurs, `found` is false. Assert on the error first to print the error.&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;remove unnecessary nested `if`&lt;br/&gt;
Branch: r1.24&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/30db519a99bc59ad47d00941d4af7ddc68a83684&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/30db519a99bc59ad47d00941d4af7ddc68a83684&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="5525618" author="xgen-internal-githook" created="Mon, 26 Jun 2023 18:11:06 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Kevin Albertson&apos;, &apos;email&apos;: &apos;kevin.albertson@mongodb.com&apos;, &apos;username&apos;: &apos;kevinAlbs&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3969&quot; title=&quot;Destruction of cursor leads to failed bson assert of the cursor server_id&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3969&quot;&gt;&lt;del&gt;CDRIVER-3969&lt;/del&gt;&lt;/a&gt; error when creating uncompleted cursor with no server ID (#1321)&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;fix type of BCON_INT32 value&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;require serverID for open cursor with `mongoc_cursor_new_from_command_reply_with_opts`&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;document expectations of server ID option&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;assert `found` after `mongoc_cursor_error`&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;If an error occurs, `found` is false. Assert on the error first to print the error.&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;remove unnecessary nested `if`&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/ffb3d349f0f95aca4f4f8b57d93fe5e085450630&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/ffb3d349f0f95aca4f4f8b57d93fe5e085450630&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="3746830" author="kevin.albertson" created="Thu, 29 Apr 2021 15:42:14 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=johannes.schulte%40inmation.com&quot; class=&quot;user-hover&quot; rel=&quot;johannes.schulte@inmation.com&quot;&gt;johannes.schulte@inmation.com&lt;/a&gt;, thank you for the bug report and the reproducible program. I was able to reproduce this against a 4.4 MongoDB server, and agree this is a valid bug.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="312458" name="destroy_cursor_bug.c" size="993" author="johannes.schulte@inmation.com" created="Thu, 29 Apr 2021 09:12:47 +0000"/>
                    </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_21553" key="com.atlassian.jira.plugin.system.customfieldtypes:labels">
                        <customfieldname>Quarter</customfieldname>
                        <customfieldvalues>
                                        <label>FY23Q3</label>
            <label>FY24Q2</label>
    
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr6i7r:f0zhw</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>