<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:29:35 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-75205] Deadlock between stepdown and restoring locks after yielding when all read tickets exhausted</title>
                <link>https://jira.mongodb.org/browse/SERVER-75205</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;After yielding, operations will&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/r4.4.18/src/mongo/db/query/plan_yield_policy.cpp#L211&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;restore their lock state&lt;/a&gt;&#160;via&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/r4.4.18/src/mongo/db/concurrency/lock_state.cpp#L821-L833&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;restoreLockState&lt;/tt&gt;&lt;/a&gt;. This function will iterate over each lock that was previously held and try to reacquire it in sorted order. However, we don&apos;t actually try to reacquire the FCV lock, which should be reacquired after the PBWM. &lt;a href=&quot;https://github.com/mongodb/mongo/blob/r4.4.18/src/mongo/db/concurrency/lock_state.cpp#L829-L833&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;When we go to try to reacquire the RSTL&lt;/a&gt;, we fail the check since the lock in question is actually the FCV lock (but we never checked for it). We will then &lt;a href=&quot;https://github.com/mongodb/mongo/blob/r4.4.18/src/mongo/db/concurrency/lock_state.cpp#L835&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;acquire the global lock&lt;/a&gt;&#160;(including a&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/r4.4.18/src/mongo/db/concurrency/lock_state.cpp#L391-L400&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;acquiring read ticket&lt;/a&gt;) without having the FCV lock or the RSTL.&lt;/p&gt;

&lt;p&gt;Once that is done, we will&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/r4.4.18/src/mongo/db/concurrency/lock_state.cpp#L836-L838&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;reacquire all the other locks we held&lt;/a&gt;, which in this case includes the RSTL (but now out of order).&lt;/p&gt;

&lt;p&gt;When the stepdown thread starts, it enqueues the RSTL in X mode, which jumps to the top of the queue. At the same time, there will operations that are holding the RSTL in IX mode, but are waiting to acquire read tickets, which is preventing the stepdown thread from proceeding. If we have exhausted all read tickets in the system, then these threads are stuck waiting while holding the RSTL but the threads holding the read tickets cannot progress since they are stuck behind the stepdown thread waiting for the RSTL.&lt;/p&gt;

&lt;p&gt;There is also a variation of this that can happen on step up when we are holding the RSTL and waiting on ticket acquisition.&#160;&lt;/p&gt;

&lt;p&gt;We should be accounting for the FCV lock &lt;a href=&quot;https://github.com/mongodb/mongo/blob/r4.4.18/src/mongo/db/concurrency/lock_state.cpp#L811-L840&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;when we restore locks&lt;/a&gt;.&lt;/p&gt;</description>
                <environment></environment>
        <key id="2296641">SERVER-75205</key>
            <summary>Deadlock between stepdown and restoring locks after yielding when all read tickets exhausted</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="1" iconUrl="https://jira.mongodb.org/images/icons/priorities/blocker.svg">Blocker - P1</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="matt.kneiser@mongodb.com">Matt Kneiser</assignee>
                                    <reporter username="samy.lanka@mongodb.com">Samyukta Lanka</reporter>
                        <labels>
                    </labels>
                <created>Thu, 23 Mar 2023 19:55:44 +0000</created>
                <updated>Wed, 20 Dec 2023 20:09:20 +0000</updated>
                            <resolved>Wed, 29 Mar 2023 18:18:06 +0000</resolved>
                                    <version>6.0.0</version>
                    <version>4.4.15</version>
                    <version>5.0.10</version>
                    <version>6.3.0-rc2</version>
                                    <fixVersion>7.0.0-rc0</fixVersion>
                    <fixVersion>4.4.20</fixVersion>
                    <fixVersion>5.0.16</fixVersion>
                    <fixVersion>6.0.6</fixVersion>
                    <fixVersion>6.3.0-rc3</fixVersion>
                                                        <votes>0</votes>
                                    <watches>45</watches>
                                                                                                                <comments>
                            <comment id="5345387" author="xgen-internal-githook" created="Thu, 13 Apr 2023 18:21:36 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Matt Kneiser&apos;, &apos;email&apos;: &apos;matt.kneiser@mongodb.com&apos;, &apos;username&apos;: &apos;themattman&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-75205&quot; title=&quot;Deadlock between stepdown and restoring locks after yielding when all read tickets exhausted&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-75205&quot;&gt;&lt;del&gt;SERVER-75205&lt;/del&gt;&lt;/a&gt; Forward port of ticket exhaustion test tweaks&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/2ad1e9ac43f4427fbcd6690c64c47e6bc26cce94&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/2ad1e9ac43f4427fbcd6690c64c47e6bc26cce94&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5310553" author="xgen-internal-githook" created="Wed, 29 Mar 2023 21:14:25 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Matt Kneiser&apos;, &apos;email&apos;: &apos;matt.kneiser@mongodb.com&apos;, &apos;username&apos;: &apos;themattman&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-75205&quot; title=&quot;Deadlock between stepdown and restoring locks after yielding when all read tickets exhausted&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-75205&quot;&gt;&lt;del&gt;SERVER-75205&lt;/del&gt;&lt;/a&gt; Fix deadlock involving FCV lock&lt;/p&gt;

&lt;p&gt;With minor jstest amendments.&lt;/p&gt;

&lt;p&gt;(cherry picked from commit e74f9c2fdf73ad707419fa4a8ae57aec70423ca6)&lt;br/&gt;
Branch: v6.3&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/62488ce91951aaf0ac35df145779778219261c0a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/62488ce91951aaf0ac35df145779778219261c0a&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5309876" author="xgen-internal-githook" created="Wed, 29 Mar 2023 17:59:58 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Matt Kneiser&apos;, &apos;email&apos;: &apos;matt.kneiser@mongodb.com&apos;, &apos;username&apos;: &apos;themattman&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-75205&quot; title=&quot;Deadlock between stepdown and restoring locks after yielding when all read tickets exhausted&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-75205&quot;&gt;&lt;del&gt;SERVER-75205&lt;/del&gt;&lt;/a&gt; Fix deadlock involving FCV lock&lt;/p&gt;

&lt;p&gt;With minor jstest amendments.&lt;/p&gt;

&lt;p&gt;(cherry picked from commit e74f9c2fdf73ad707419fa4a8ae57aec70423ca6)&lt;br/&gt;
Branch: v6.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/065114a92afecff15d89cf4de35132e0c68893ab&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/065114a92afecff15d89cf4de35132e0c68893ab&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5308495" author="xgen-internal-githook" created="Wed, 29 Mar 2023 09:44:54 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Matt Kneiser&apos;, &apos;email&apos;: &apos;matt.kneiser@mongodb.com&apos;, &apos;username&apos;: &apos;themattman&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-75205&quot; title=&quot;Deadlock between stepdown and restoring locks after yielding when all read tickets exhausted&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-75205&quot;&gt;&lt;del&gt;SERVER-75205&lt;/del&gt;&lt;/a&gt; Fix deadlock involving FCV lock&lt;/p&gt;

&lt;p&gt;With minor jstest amendments.&lt;/p&gt;

&lt;p&gt;(cherry picked from commit e74f9c2fdf73ad707419fa4a8ae57aec70423ca6)&lt;br/&gt;
Branch: v5.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/b2e62a90e39c2ede741c5c92e78f85d192bb9d68&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/b2e62a90e39c2ede741c5c92e78f85d192bb9d68&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5308485" author="xgen-internal-githook" created="Wed, 29 Mar 2023 09:40:10 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Matt Kneiser&apos;, &apos;email&apos;: &apos;matt.kneiser@mongodb.com&apos;, &apos;username&apos;: &apos;themattman&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-75205&quot; title=&quot;Deadlock between stepdown and restoring locks after yielding when all read tickets exhausted&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-75205&quot;&gt;&lt;del&gt;SERVER-75205&lt;/del&gt;&lt;/a&gt; Fix deadlock involving FCV lock&lt;/p&gt;

&lt;p&gt;With minor jstest amendments.&lt;/p&gt;

&lt;p&gt;(cherry picked from commit e74f9c2fdf73ad707419fa4a8ae57aec70423ca6)&lt;br/&gt;
Branch: v4.4&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/6b9275d8629aac59912bcee8cb3cf4dbe86da2b9&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/6b9275d8629aac59912bcee8cb3cf4dbe86da2b9&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5308115" author="xgen-internal-githook" created="Wed, 29 Mar 2023 03:12:25 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Matt Kneiser&apos;, &apos;email&apos;: &apos;matt.kneiser@mongodb.com&apos;, &apos;username&apos;: &apos;themattman&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-75205&quot; title=&quot;Deadlock between stepdown and restoring locks after yielding when all read tickets exhausted&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-75205&quot;&gt;&lt;del&gt;SERVER-75205&lt;/del&gt;&lt;/a&gt; Fix deadlock involving FCV lock&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/e74f9c2fdf73ad707419fa4a8ae57aec70423ca6&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/e74f9c2fdf73ad707419fa4a8ae57aec70423ca6&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10420">
                    <name>Backports</name>
                                            <outwardlinks description="backported by">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10520">
                    <name>Problem/Incident</name>
                                            <outwardlinks description="causes">
                                                        </outwardlinks>
                                                                <inwardlinks description="is caused by">
                                        <issuelink>
            <issuekey id="2028940">SERVER-65821</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="2530129">SERVER-84353</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2297497">SERVER-75262</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                                        </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>6.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25376"><![CDATA[v6.3]]></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[[5006R00001s6FsAQAU, 5006R00001r80vgQAA, 5006R00001s7nUwQAI, 5006R00001s7UaqQAE, 5006R00001sBxQnQAK, 5006R00001s9EN8QAM, 5006R00001sCizBQAS, 5006R00001r6iqLQAQ, 5006R00001sEUyrQAG, 5006R00001srJgzQAE, 5006R00001srJh4QAE, 5006R00001ss1P6QAI, 5006R00001srgxcQAA, 5006R00001tKMDFQA4, 5006R00001sroSIQAY]]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 24 Mar 2023 16:11:17 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        42 weeks, 6 days 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_17050" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Downstream Team Attention</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16941"><![CDATA[Not Needed]]></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>brad.cater@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            42 weeks, 6 days ago
                        </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>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>matt.kneiser@mongodb.com</customfieldvalue>
            <customfieldvalue>samy.lanka@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i21lz3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i1jysg:</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_22250" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Special Downgrade Instructions Required</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="23343"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="6819">Execution Team 2023-04-03</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|i2184f:</customfieldvalue>

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