<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:11:56 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-1221] mongoc_cursor_is_alive() returns false for live cursor from find command</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-1221</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;After upgrading PHPC and HHVM to 1.4.0-dev, we started seeing some failed tests that were asserting whether a cursor returned by a &lt;tt&gt;find&lt;/tt&gt; command was dead or alive (&lt;a href=&quot;https://jira.mongodb.org/browse/PHPC-673&quot; title=&quot;Cursor::isDead() returns true despite cursor being alive&quot; class=&quot;issue-link&quot; data-issue-key=&quot;PHPC-673&quot;&gt;&lt;del&gt;PHPC-673&lt;/del&gt;&lt;/a&gt;). If we change the test to use OP_QUERY by connecting to a 3.0 (or earlier) server, it passes. The current logic is:&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;return (!cursor-&amp;gt;sent ||&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_FAILED (cursor) &amp;amp;&amp;amp;&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-&amp;gt;done &amp;amp;&amp;amp;&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-&amp;gt;rpc.header.opcode == MONGOC_OPCODE_REPLY) &amp;amp;&amp;amp;&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;         cursor-&amp;gt;rpc.reply.cursor_id));&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;The last change to this code was the addition of &lt;tt&gt;CURSOR_FAILED()&lt;/tt&gt; in &lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/a3d0fe2fab7abfb1bd343ab51fd254f09b6af083&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;a3d0fe2&lt;/a&gt; for &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-838&quot; title=&quot;Support find, getMore and killCursor commands&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-838&quot;&gt;&lt;del&gt;CDRIVER-838&lt;/del&gt;&lt;/a&gt;, which I don&apos;t believe is related since it predates 1.4.0-dev.&lt;/p&gt;

&lt;p&gt;Some debugging revealed that &lt;tt&gt;cursor-&amp;gt;rpc.header.opcode&lt;/tt&gt; is the cause. For a freshly executed query on its first batch (of two), I observed 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;cursor-&amp;gt;sent: 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;&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_FAILED: 0&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-&amp;gt;done: 0&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-&amp;gt;rpc.header.opcode: 0&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;cursor-&amp;gt;rpc.reply.cursor_id: 2061799758&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;We would expect &lt;tt&gt;cursor-&amp;gt;rpc.header.opcode&lt;/tt&gt; to be 1 (i.e. MONGOC_OPCODE_REPLY) here, as it is with a legacy OP_QUERY or on any 1.3.x version of libmongoc. This appears to be a regression.&lt;/p&gt;</description>
                <environment></environment>
        <key id="284823">CDRIVER-1221</key>
            <summary>mongoc_cursor_is_alive() returns false for live cursor from find command</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="9">Done</resolution>
                                        <assignee username="jesse@mongodb.com">A. Jesse Jiryu Davis</assignee>
                                    <reporter username="jmikola@mongodb.com">Jeremy Mikola</reporter>
                        <labels>
                    </labels>
                <created>Thu, 5 May 2016 20:16:56 +0000</created>
                <updated>Wed, 10 Aug 2016 22:10:28 +0000</updated>
                            <resolved>Tue, 10 May 2016 18:42:35 +0000</resolved>
                                    <version>1.4.0</version>
                                    <fixVersion>1.4.0</fixVersion>
                                    <component>libmongoc</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1268778" author="xgen-internal-githook" created="Thu, 19 May 2016 13:58:36 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jmikola&apos;, u&apos;name&apos;: u&apos;Jeremy Mikola&apos;, u&apos;email&apos;: u&apos;jmikola@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/PHPC-673&quot; title=&quot;Cursor::isDead() returns true despite cursor being alive&quot; class=&quot;issue-link&quot; data-issue-key=&quot;PHPC-673&quot;&gt;&lt;del&gt;PHPC-673&lt;/del&gt;&lt;/a&gt;: Fix Cursor::isDead() tests for mongoc_cursor_is_alive()&lt;/p&gt;

&lt;p&gt;This changes our tests based on upstream fixes for mongoc_cursor_is_alive() in &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1221&quot; title=&quot;mongoc_cursor_is_alive() returns false for live cursor from find command&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-1221&quot;&gt;&lt;del&gt;CDRIVER-1221&lt;/del&gt;&lt;/a&gt;.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-php-driver/commit/c0046a3e631cd412f5673f4ae2b04c9210a04b3e&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-php-driver/commit/c0046a3e631cd412f5673f4ae2b04c9210a04b3e&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1261265" author="jesse" created="Tue, 10 May 2016 20:35:08 +0000"  >&lt;p&gt;AFAICT as far back as 1.2.0, if you have more than 101 docs in a collection and do &quot;find&quot;, &quot;is_alive&quot; is false after the 101st document.&lt;/p&gt;</comment>
                            <comment id="1261264" author="jmikola@gmail.com" created="Tue, 10 May 2016 20:32:32 +0000"  >&lt;blockquote&gt;&lt;p&gt;Furthermore, there was a bug where a multi-batch cursor was not &quot;alive&quot; after the first batch, a bug which predates 1.2.0. That bug is fixed in the patch for this issue.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;If I understand correctly, we should be able to verify this long-standing bug by tweaking our tests to iterate over three batches instead of two? With the bugged behavior, we would see the cursor marked as dead during the middle batch, when it is very much still alive.&lt;/p&gt;</comment>
                            <comment id="1261096" author="jesse" created="Tue, 10 May 2016 18:42:35 +0000"  >&lt;p&gt;Actually, I&apos;ve tested back to 1.2.0 with MongoDB 2.6 (so, before the &quot;find&quot; command), and the behavior seems consistent: it&apos;s not until &lt;b&gt;after&lt;/b&gt; mongoc_cursor_next has returned NULL that mongoc_cursor_is_alive is false.&lt;/p&gt;

&lt;p&gt;Furthermore, there was a bug where a multi-batch cursor was not &quot;alive&quot; after the first batch, a bug which predates 1.2.0. That bug is fixed in the patch for this issue.&lt;/p&gt;</comment>
                            <comment id="1259805" author="jesse" created="Mon, 9 May 2016 19:38:15 +0000"  >&lt;p&gt;My fix wasn&apos;t correct at the final document. If there are 3 documents and batch size is 2, mongoc_cursor_is_alive should be true after the first 2 calls to mongoc_cursor_next, then &lt;b&gt;false after the 3rd call&lt;/b&gt;. Instead, it&apos;s false after the 4th call (the first call to mongoc_cursor_next that returns false).&lt;/p&gt;</comment>
                            <comment id="1259675" author="xgen-internal-githook" created="Mon, 9 May 2016 18:17:09 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-1221&quot; title=&quot;mongoc_cursor_is_alive() returns false for live cursor from find command&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-1221&quot;&gt;&lt;del&gt;CDRIVER-1221&lt;/del&gt;&lt;/a&gt; fix mongoc_cursor_is_alive&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/d6731fb93d8121b9ff36182f227621c10d996c5f&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/d6731fb93d8121b9ff36182f227621c10d996c5f&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="279810">PHPC-673</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="287342">CDRIVER-1234</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|hsl5gn:</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>