<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:45:53 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-81226] Deadlock between _commitSplitPreparedTxnOnPrimary and stepDown</title>
                <link>https://jira.mongodb.org/browse/SERVER-81226</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;When we &lt;a href=&quot;https://github.com/mongodb/mongo/blob/97b87248d11cee4d48ba4865b782b94e65c58e85/src/mongo/db/transaction/transaction_participant.cpp#L2123-L2124&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;loop through all split sessions&lt;/a&gt;, it is possible that some &lt;a href=&quot;https://github.com/mongodb/mongo/blob/97b87248d11cee4d48ba4865b782b94e65c58e85/src/mongo/db/transaction/transaction_participant.cpp#L2135-L2161&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;splitOpCtx&lt;/a&gt; may successfully acquire the RSTL while others are blocked behind stepDown (e.g. when stepDown happens in the middle of this loop). &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-79950&quot; title=&quot;Fix commitPreparedTransaction to not be interruptible in commitSplitTxn and reacquireTicket&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-79950&quot;&gt;&lt;del&gt;SERVER-79950&lt;/del&gt;&lt;/a&gt; added &lt;tt&gt;UninterruptibleLockGuard&lt;/tt&gt; to all &lt;tt&gt;splitOpCtx&lt;/tt&gt; and so &lt;tt&gt;_commitSplitPreparedTxnOnPrimary&lt;/tt&gt; is not interruptible by stepDown. In the case mentioned above, if some but not all of the &lt;tt&gt;splitOpCtx&lt;/tt&gt; in &lt;tt&gt;_commitSplitPreparedTxnOnPrimary&lt;/tt&gt; already hold RSTL in IX mode, it will block stepDown while not being able to make progress. Thus, we have a deadlock.&lt;/p&gt;</description>
                <environment></environment>
        <key id="2446447">SERVER-81226</key>
            <summary>Deadlock between _commitSplitPreparedTxnOnPrimary and stepDown</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="13201">Fixed</resolution>
                                        <assignee username="wenbin.zhu@mongodb.com">Wenbin Zhu</assignee>
                                    <reporter username="lingzhi.deng@mongodb.com">Lingzhi Deng</reporter>
                        <labels>
                    </labels>
                <created>Tue, 19 Sep 2023 21:56:29 +0000</created>
                <updated>Sun, 29 Oct 2023 21:16:10 +0000</updated>
                            <resolved>Thu, 5 Oct 2023 17:43:09 +0000</resolved>
                                                    <fixVersion>7.2.0-rc0</fixVersion>
                    <fixVersion>7.0.3</fixVersion>
                                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="5771392" author="xgen-internal-githook" created="Wed, 11 Oct 2023 18:38:05 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Wenbin Zhu&apos;, &apos;email&apos;: &apos;wenbin.zhu@mongodb.com&apos;, &apos;username&apos;: &apos;WenbinZhu&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-81226&quot; title=&quot;Deadlock between _commitSplitPreparedTxnOnPrimary and stepDown&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-81226&quot;&gt;&lt;del&gt;SERVER-81226&lt;/del&gt;&lt;/a&gt; Do not acquire RSTL for commit and abort of split transactions.&lt;br/&gt;
Branch: v7.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/a463662ab2bf1b43008de7cc2f5bbee77d4edd34&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/a463662ab2bf1b43008de7cc2f5bbee77d4edd34&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5756402" author="xgen-internal-githook" created="Thu, 5 Oct 2023 17:36:43 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Wenbin Zhu&apos;, &apos;email&apos;: &apos;wenbin.zhu@mongodb.com&apos;, &apos;username&apos;: &apos;WenbinZhu&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-81226&quot; title=&quot;Deadlock between _commitSplitPreparedTxnOnPrimary and stepDown&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-81226&quot;&gt;&lt;del&gt;SERVER-81226&lt;/del&gt;&lt;/a&gt; Do not acquire RSTL for commit and abort of split transactions.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/ada003749da8ec582c7bce1e5d97ca7e1b91362b&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/ada003749da8ec582c7bce1e5d97ca7e1b91362b&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5741801" author="JIRAUSER1258790" created="Fri, 29 Sep 2023 19:37:54 +0000"  >&lt;p&gt;So here is what happened: I think I was right that split transactions do not acquire RSTL as part of &lt;tt&gt;unstashTransactionResources&lt;/tt&gt;, however split transactions &lt;a href=&quot;https://github.com/10gen/mongo/blob/c0af87c74fd301376b9e9bbb2ed85b804a900994/src/mongo/db/transaction/transaction_participant.cpp#L2167&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;manually acquire a GlobalLock&lt;/a&gt; after &lt;tt&gt;unstashTransactionResources&lt;/tt&gt; and acquiring the GlobalLock &lt;a href=&quot;https://github.com/10gen/mongo/blob/c0af87c74fd301376b9e9bbb2ed85b804a900994/src/mongo/db/concurrency/d_concurrency.cpp#L128&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;involves acquiring an RSTL&lt;/a&gt;. I think we should either use the &lt;a href=&quot;https://github.com/10gen/mongo/blob/c0af87c74fd301376b9e9bbb2ed85b804a900994/src/mongo/db/concurrency/d_concurrency.cpp#L105&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;skipRSTLLock option&lt;/a&gt; to avoid acquiring RSTL in this case or maybe we don&apos;t need to &lt;a href=&quot;https://github.com/mongodb/mongo/blob/17bafc133a9940cdd30d6ea63f46a6cadbd1e30a/src/mongo/db/transaction/transaction_participant.cpp#L2157&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;acquire the GlobalLock&lt;/a&gt; in the first place.&lt;/p&gt;

&lt;p&gt;Abort has the same issue as the split transactions call &lt;a href=&quot;https://github.com/mongodb/mongo/blob/17bafc133a9940cdd30d6ea63f46a6cadbd1e30a/src/mongo/db/transaction/transaction_participant.cpp#L2373&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;newTxnParticipant.abortTransaction()&lt;/a&gt; after unstash, which also &lt;a href=&quot;https://github.com/mongodb/mongo/blob/17bafc133a9940cdd30d6ea63f46a6cadbd1e30a/src/mongo/db/transaction/transaction_participant.cpp#L2250&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;acquires RSTL here&lt;/a&gt;. I think ideally we should&#160; manually abort the storage txn and cleanup&#160; (similar to the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/17bafc133a9940cdd30d6ea63f46a6cadbd1e30a/src/mongo/db/transaction/transaction_participant.cpp#L2156-L2166&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;commit case&lt;/a&gt;) instead of using abortTransaction(), but I vaguely remember DanG mentioned he didn&apos;t do that because of some reason.&lt;/p&gt;</comment>
                            <comment id="5739294" author="JIRAUSER1258790" created="Thu, 28 Sep 2023 23:05:51 +0000"  >&lt;p&gt;After giving this a second thought, I&apos;m not sure why the &lt;tt&gt;splitOpCtxs&lt;/tt&gt; needs to acquire RSTL in the first place. When we prepare a transaction, no matter on primary or secondary, we always &lt;a href=&quot;https://github.com/mongodb/mongo/blob/17bafc133a9940cdd30d6ea63f46a6cadbd1e30a/src/mongo/db/transaction/transaction_participant.cpp#L1825-L1828&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;release the RSTL at the end of prepare&lt;/a&gt;, so I when unstashing the split transaction for commit, I think there should be no RSTL in the stashed lock snapshot? I will take a look at the original BF to see if it&apos;s something else.&lt;/p&gt;</comment>
                            <comment id="5716857" author="JIRAUSER1258790" created="Wed, 20 Sep 2023 04:55:04 +0000"  >&lt;p&gt;Since on primary we apply the split transactions serially, I&apos;m wondering if it is possible to reuse the parent OpCtx&apos;s locker for the child OpCtx? I&apos;m not sure if the current locker contract allows this kind of pattern though.&lt;/p&gt;</comment>
                            <comment id="5716638" author="lingzhi.deng" created="Tue, 19 Sep 2023 23:55:24 +0000"  >&lt;p&gt;Since we know that the thread committing the prepared transaction must &lt;a href=&quot;https://github.com/mongodb/mongo/blob/97b87248d11cee4d48ba4865b782b94e65c58e85/src/mongo/db/transaction/transaction_participant.cpp#L1969-L1971&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;already hold RSTL in IX mode&lt;/a&gt; and it&apos;s &lt;a href=&quot;https://github.com/mongodb/mongo/blob/97b87248d11cee4d48ba4865b782b94e65c58e85/src/mongo/db/transaction/transaction_participant.cpp#L2015-L2017&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;uninterruptible&lt;/a&gt;, maybe the split sessions can use the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/97b87248d11cee4d48ba4865b782b94e65c58e85/src/mongo/db/concurrency/lock_manager_defs.h#L434-L442&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;compatibleFirst&lt;/a&gt; option to acquire their RSTL locks.&lt;/p&gt;

&lt;p&gt;Additionally, I think the split sessions technically don&apos;t need to acquire the RSTL again given that it&apos;s already acquired at the top level. I wonder if we did that only because we needed to satisfy certain invariants down the line. &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">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="2415979">SERVER-79950</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </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>2.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25128"><![CDATA[Replication]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25578"><![CDATA[v7.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>Wed, 20 Sep 2023 04:55:04 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        17 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_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>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            17 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>120.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>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>lingzhi.deng@mongodb.com</customfieldvalue>
            <customfieldvalue>wenbin.zhu@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i2r9ov:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i297zo:</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="7777">Repl 2023-10-02</customfieldvalue>
    <customfieldvalue id="7778">Repl 2023-10-16</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|i2qvu7:</customfieldvalue>

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