<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:58:11 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>[SERVER-21710] Allow pinned ClientCursors to be killed on mongod</title>
                <link>https://jira.mongodb.org/browse/SERVER-21710</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;On mongod, a killCursors command or OP_KILL_CURSORS message acting on a pinned cursor will fail to kill the cursor. By contrast, the mongos ClusterCursorManager can kill an alive cursor regardless of whether or not it is pinned. We should change the mongod behavior to be consistent with that of mongos. The killCursors operation should make a best effort to kill all cursors, irrespective of whether the cursor is currently in use. Failing to kill in this edge case opens the possibility of leaked ClientCursors.&lt;/p&gt;</description>
                <environment></environment>
        <key id="241653">SERVER-21710</key>
            <summary>Allow pinned ClientCursors to be killed on mongod</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="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="ian.boros@mongodb.com">Ian Boros</assignee>
                                    <reporter username="david.storch@mongodb.com">David Storch</reporter>
                        <labels>
                    </labels>
                <created>Tue, 1 Dec 2015 17:10:53 +0000</created>
                <updated>Mon, 29 Jan 2018 17:31:24 +0000</updated>
                            <resolved>Wed, 10 Jan 2018 20:01:07 +0000</resolved>
                                                    <fixVersion>3.7.1</fixVersion>
                                    <component>Querying</component>
                                        <votes>1</votes>
                                    <watches>10</watches>
                                                                                                                <comments>
                            <comment id="1770342" author="xgen-internal-githook" created="Wed, 10 Jan 2018 16:44:09 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;email&apos;: &apos;ian.boros@10gen.com&apos;, &apos;name&apos;: &apos;Ian Boros&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-21710&quot; title=&quot;Allow pinned ClientCursors to be killed on mongod&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-21710&quot;&gt;&lt;del&gt;SERVER-21710&lt;/del&gt;&lt;/a&gt; Add ability to kill pinned cursors on mongod&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/da80e97d103434a6bc566c589a23af13477e1a28&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/da80e97d103434a6bc566c589a23af13477e1a28&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1720286" author="david.storch" created="Wed, 8 Nov 2017 13:53:15 +0000"  >&lt;p&gt;Yeah, that&apos;s known behavior, thanks for the correction. Changing that should fall into the scope of this ticket as well.&lt;/p&gt;</comment>
                            <comment id="1719683" author="jeff.yemin" created="Tue, 7 Nov 2017 19:56:34 +0000"  >&lt;p&gt;FWIW killSessions doesn&apos;t work when there is a pinned change stream cursor associated with the session:&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;// request&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;{ &quot;killSessions&quot; : [{ &quot;id&quot; : { &quot;$binary&quot; : &quot;faSCkv0KTxePjULgM1JiuQ==&quot;, &quot;$type&quot; : &quot;04&quot; } }], &quot;$db&quot; : &quot;admin&quot;, ... }&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;// response&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;{ &quot;ok&quot; : 0.0, &quot;errmsg&quot; : &quot;Cannot kill pinned cursor: 7646490736246576201&quot;, &quot;code&quot; : 96, &quot;codeName&quot; : &quot;OperationFailed&quot;... }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</comment>
                            <comment id="1719627" author="david.storch" created="Tue, 7 Nov 2017 19:14:26 +0000"  >&lt;p&gt;I see. Clients should not attempt to issue &lt;tt&gt;killCursors&lt;/tt&gt; from a separate thread. Since killing pinned cursors has never been supported, &lt;tt&gt;killCursors&lt;/tt&gt; is a way for the thread that is iterating the cursor to safely abandon it without exhausting the result set. It has never been a way to kill an active cursor from another thread. That&apos;s what &lt;tt&gt;killOp&lt;/tt&gt;/&lt;tt&gt;killSessions&lt;/tt&gt; are for. &lt;tt&gt;$changeStream&lt;/tt&gt; cursors, and tailable cursors in general, are certainly more susceptible to this problem since cursors are pinned for longer. But it&apos;s never a good idea to use &lt;tt&gt;killCursors&lt;/tt&gt; while a &lt;tt&gt;getMore&lt;/tt&gt; may be in progress on versions 3.6 and older.&lt;/p&gt;

&lt;p&gt;Clearly it would be desirable to allow applications to behave as you describe against future versions of the server. As I alluded to above, we&apos;re hoping to schedule this ticket as part of an effort to make killing queries easier, especially queries against sharded clusters.&lt;/p&gt;</comment>
                            <comment id="1719561" author="jeff.yemin" created="Tue, 7 Nov 2017 18:19:10 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=david.storch&quot; class=&quot;user-hover&quot; rel=&quot;david.storch&quot;&gt;david.storch&lt;/a&gt; a change stream cursor will typically remain pinned for the majority of its lifetime when the collection that is being watched is mostly idle.  Furthermore, because drivers generally iterate cursors in a blocking fashion, for tailable cursors there is typically a loop within the call to cursor.next() which repeatedly calls getMore until at least one document is returned or until an error is reported (e.g. cursorNotFound).  So if an application contains a thread that is blocking on a change stream cursor, and another thread that attempts to kill that cursor in order to unblock the first thread, the killCursors command can fail with the following error:&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;{ &quot;ok&quot; : 0.0, &quot;errmsg&quot; : &quot;cursor id 5290539973175233834 is already in use&quot;, &quot;code&quot; : 12051, &quot;codeName&quot; : &quot;Location12051&quot;, ... }&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;This is different from what&apos;s reported for a normal tailable cursor in a similar situation:&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;{ &quot;cursorsKilled&quot; : [], &quot;cursorsNotFound&quot; : [], &quot;cursorsAlive&quot; : [{ &quot;$numberLong&quot; : &quot;237307113234&quot; }], &quot;cursorsUnknown&quot; : [], &quot;ok&quot; : 1.0, ... }&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;but the effect is the same: the cursor remains alive, and an application with a thread blocking on the cursor iteration may never exit.&lt;/p&gt;

&lt;p&gt;Drivers &lt;em&gt;could&lt;/em&gt; work around this by inserting within that inner loop that&apos;s calling getMore a check of whether the application has at least attempted to close the cursor, and that would catch most of the problems, but currently that&apos;s not specified behavior for all drivers.  But that has the bad effect of leaving the change stream cursor open on the server until it times out.&lt;/p&gt;</comment>
                            <comment id="1719407" author="david.storch" created="Tue, 7 Nov 2017 16:37:24 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jeff.yemin&quot; class=&quot;user-hover&quot; rel=&quot;jeff.yemin&quot;&gt;jeff.yemin&lt;/a&gt;, I&apos;m not sure I follow the relationship between this ticket and change streams, can you elaborate?&lt;/p&gt;

&lt;p&gt;Note that pinned cursors may be killed with killOp. Also note that we hope to improve cursor-killing behavior for 3.8. Our hope is that in 3.8 users will be able to preemptively kill all cursors belonging to a sharded operation using &lt;tt&gt;killSessions&lt;/tt&gt;.&lt;/p&gt;</comment>
                            <comment id="1717874" author="jeff.yemin" created="Mon, 6 Nov 2017 19:03:30 +0000"  >&lt;p&gt;This appears to be the root cause of &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-2651&quot; title=&quot;Unable to exit from hasNext() for tailable cursor if cursor was closed from another thread&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-2651&quot;&gt;&lt;del&gt;JAVA-2651&lt;/del&gt;&lt;/a&gt;, where a user reports a tailable cursor that won&apos;t die.  &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=david.storch&quot; class=&quot;user-hover&quot; rel=&quot;david.storch&quot;&gt;david.storch&lt;/a&gt; I&apos;m wondering if this affects change streams, as the pattern of closing a change stream cursor from another thread, in order to stop the change stream cursor iteration, is likely to be quite common.  &lt;/p&gt;</comment>
                            <comment id="1493981" author="redbeard0531" created="Tue, 7 Feb 2017 16:16:08 +0000"  >&lt;p&gt;This will be needed to support abandoning exhaust cursors without closing the connection.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="471776">SERVER-32307</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="356817">SERVER-28090</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="454532">JAVA-2651</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="457244">DRIVERS-421</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>8.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 7 Feb 2017 16:16:08 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        6 years, 5 weeks ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <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>PM-943</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            6 years, 5 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>david.storch@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>ian.boros@mongodb.com</customfieldvalue>
            <customfieldvalue>jeff.yemin@mongodb.com</customfieldvalue>
            <customfieldvalue>mathias@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrknd3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr9c6f:</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>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="2076">Query 2018-01-01</customfieldvalue>
    <customfieldvalue id="2077">Query 2018-01-15</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hsfedr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>