<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:42:47 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-36332] CursorNotFound error in GetMore on a secondary with sessions</title>
                <link>https://jira.mongodb.org/browse/SERVER-36332</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Various issues related to sessions synchronization during refresh are caused by the design.&lt;br/&gt;
Currently, the only way to update the config.system.sessions collection is by refresh method which is run in a separate thread on the primary.&lt;br/&gt;
Secondary does not write to the collection instead it sends sessions to the primary which adds it to a logical sessions cache and eventually writes to the collection.&lt;br/&gt;
However the secondary closes the cursors associated with sessions not existing in the sessions collection. &lt;br/&gt;
This scenario is possible if secondary and primary refreshes are out of synch. i.e.&lt;br/&gt;
1) secondary adds new sessions and opens cursors&lt;br/&gt;
2) secondary refresh updates primary logical session cache&lt;br/&gt;
3) if secondary rins a refresh now the newly opened sessions will be considered &quot;deleted&quot; because the primary has not yet refreshed&lt;/p&gt;

&lt;p&gt;The following sequence of events is an example of this scenario&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Primary is unavailable for writes (say it&apos;s fsyncLocked).&lt;/li&gt;
	&lt;li&gt;Client creates a session on a secondary and establishes a cursor without fully iterating it.&lt;/li&gt;
	&lt;li&gt;The session cache refresh logic kicks in&lt;/li&gt;
	&lt;li&gt;The secondary sends a refreshSessionsInternal command to the primary (from&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/077a5b00937a539ef004f986ac08f9c51cf0e92e/src/mongo/db/logical_session_cache_impl.cpp#L343&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;) with the sessions it believes are active, which includes this new one.&lt;/li&gt;
	&lt;li&gt;The primary receives the command, inserts the new session into its cache &lt;a href=&quot;https://github.com/mongodb/mongo/blob/077a5b00937a539ef004f986ac08f9c51cf0e92e/src/mongo/db/logical_session_cache_impl.cpp#L135&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;(&apos;_activeSessions&apos;, here)&lt;/a&gt;, but does not actually write it to system.sessions.&lt;/li&gt;
	&lt;li&gt;The secondary then attempts to find which sessions it has open cursors for which have actually been timed out, so that it can kill them. To do this, it issues a query to the system.sessions collection on the primary. This collection will not actually have this new session, since it&apos;s fsyncLocked, and further the session refresh logic hasn&apos;t kicked in yet.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;The problem shows manifestation is the &quot;CursorNotFound&quot; error on the GetMore command when running on the secondary.&lt;/p&gt;

&lt;p&gt;The fix makes the secondary write to the primary so its always in sync and therefore can avoid &quot;false negatives&quot; checks for sessions existence.&lt;/p&gt;</description>
                <environment></environment>
        <key id="577725">SERVER-36332</key>
            <summary>CursorNotFound error in GetMore on a secondary with sessions</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="misha.tyulenev@mongodb.com">Misha Tyulenev</assignee>
                                    <reporter username="charlie.swanson@mongodb.com">Charlie Swanson</reporter>
                        <labels>
                    </labels>
                <created>Fri, 27 Jul 2018 21:02:14 +0000</created>
                <updated>Sun, 29 Oct 2023 22:29:27 +0000</updated>
                            <resolved>Tue, 28 Aug 2018 18:12:15 +0000</resolved>
                                                    <fixVersion>3.6.8</fixVersion>
                    <fixVersion>4.0.3</fixVersion>
                    <fixVersion>4.1.3</fixVersion>
                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>17</watches>
                                                                                                                <comments>
                            <comment id="2000068" author="xgen-internal-githook" created="Tue, 11 Sep 2018 21:48:45 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Misha Tyulenev&apos;, &apos;email&apos;: &apos;misha@mongodb.com&apos;, &apos;username&apos;: &apos;mikety&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-36332&quot; title=&quot;CursorNotFound error in GetMore on a secondary with sessions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-36332&quot;&gt;&lt;del&gt;SERVER-36332&lt;/del&gt;&lt;/a&gt; write to primary from secondary in LogicalSessionsCache for ReplicaSet&lt;/p&gt;

&lt;p&gt;(cherry picked from commit a3d17a55ca68ba37eb59620e04258f61f133b21f)&lt;br/&gt;
Branch: v4.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/3bbae86850a5cb6aa5f264c4a7a400a7b1cacf39&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/3bbae86850a5cb6aa5f264c4a7a400a7b1cacf39&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1995678" author="xgen-internal-githook" created="Thu, 6 Sep 2018 19:59:47 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Misha Tyulenev&apos;, &apos;email&apos;: &apos;misha@mongodb.com&apos;, &apos;username&apos;: &apos;mikety&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-36332&quot; title=&quot;CursorNotFound error in GetMore on a secondary with sessions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-36332&quot;&gt;&lt;del&gt;SERVER-36332&lt;/del&gt;&lt;/a&gt; write to primary from secondary in LogicalSessionsCache for ReplicaSet&lt;/p&gt;

&lt;p&gt;(cherry picked from commit a3d17a55ca68ba37eb59620e04258f61f133b21f)&lt;br/&gt;
Branch: v3.6&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/8e7efe49690f06942c73afb81dea7a3928e19896&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/8e7efe49690f06942c73afb81dea7a3928e19896&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1991744" author="thomas.schubert" created="Mon, 3 Sep 2018 11:29:05 +0000"  >&lt;p&gt;Yes, we intend to backport this fix to 3.6, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ondrejk&quot; class=&quot;user-hover&quot; rel=&quot;ondrejk&quot;&gt;ondrejk&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="1991743" author="ondrejk" created="Mon, 3 Sep 2018 11:23:51 +0000"  >&lt;p&gt;Hi, &quot;Fix Versions&quot; says &quot;4.1.3&quot;, is this to be backported to 3.6 as well? It says so in &quot;Backport Requested&quot;&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;</comment>
                            <comment id="1987910" author="xgen-internal-githook" created="Tue, 28 Aug 2018 18:20:48 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Misha Tyulenev&apos;, &apos;email&apos;: &apos;misha@mongodb.com&apos;, &apos;username&apos;: &apos;mikety&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-36332&quot; title=&quot;CursorNotFound error in GetMore on a secondary with sessions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-36332&quot;&gt;&lt;del&gt;SERVER-36332&lt;/del&gt;&lt;/a&gt; write to primary from secondary in LogicalSessionsCache for ReplicaSet&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/a3d17a55ca68ba37eb59620e04258f61f133b21f&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/a3d17a55ca68ba37eb59620e04258f61f133b21f&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10420">
                    <name>Backports</name>
                                            <outwardlinks description="backported by">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="514681">SERVER-34053</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="516137">SERVER-34120</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="592732">SERVER-36808</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="632793">SERVER-38101</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="192884" name="repro.js" size="834" author="charlie.swanson@mongodb.com" created="Fri, 27 Jul 2018 21:01:49 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>5.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_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="15640"><![CDATA[v4.0]]></customfieldvalue>
    <customfieldvalue key="15141"><![CDATA[v3.6]]></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_13552" key="com.go2group.jira.plugin.crm:crm_generic_field">
                        <customfieldname>Case</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[[500A000000bxrhQIAQ, 500A000000bxuVhIAI, 500A000000bRz4ZIAS, 5002K00000e8sEaQAI, 5002K00000gmhmRQAQ, 5002K00000qceNjQAI, 5002K000011BSP4QAO]]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 14 Aug 2018 17:06:06 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        5 years, 22 weeks, 1 day 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-1237</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>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            5 years, 22 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>20.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>charlie.swanson@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>kelsey.schubert@mongodb.com</customfieldvalue>
            <customfieldvalue>misha.tyulenev@mongodb.com</customfieldvalue>
            <customfieldvalue>ondrejk</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hu3ou7:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|htucvb:</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="2452">Sharding 2018-08-27</customfieldvalue>
    <customfieldvalue id="2481">Sharding 2018-09-10</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;I&apos;ve attached&#160;&lt;span class=&quot;nobr&quot;&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/attachment/192884/192884_repro.js&quot; title=&quot;repro.js attached to SERVER-36332&quot;&gt;repro.js&lt;sup&gt;&lt;img class=&quot;rendericon&quot; src=&quot;https://jira.mongodb.org/images/icons/link_attachment_7.gif&quot; height=&quot;7&quot; width=&quot;7&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;&#160;which reproduces the issue.&lt;/p&gt;</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|hu3b3j:</customfieldvalue>

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