<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:46:10 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-37499] Potential deadlock when using exchange within a session</title>
                <link>https://jira.mongodb.org/browse/SERVER-37499</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;During an exchange, we have the possibility of one thread checking out the session catalog state for the session, then blocking while waiting for another thread which is part of the same session to perform work. Because all the consumers of the exchange would be in the same session, that thread which the original thread is waiting on would be unable to proceed because it first needs to check out the session catalog state, which the original state is holding.&lt;/p&gt;

&lt;p&gt;For example, consider an exchange with two consumers opened within a session. A single mongod will have two cursors (ID X and ID Y) open which are pulling data from the same &lt;tt&gt;Exchange&lt;/tt&gt;. If there are two active getMores running, one for X and one for Y, only one can hold the session state at a time, so only one can proceed into the exchange at once. Imagine the getMore for X wins the race and checks out the session, but then finds that the buffer for its part of the exchange output is empty. This thread will then iterate the input stage to the &lt;tt&gt;Exchange&lt;/tt&gt; in an attempt to fill up it&apos;s buffer. However, it might find that all the subsequent results should go into the buffer for the consumer feeding into cursor Y, and that buffer is full. In this case, the thread for the getMore on X has to wait until the consumer for cursor Y consumes the results before it can proceed. Of course, that getMore cannot proceed because it first needs to check out the session state - thus we have a deadlock.&lt;/p&gt;

&lt;p&gt;Two possible solutions we have thought of thus far:&lt;br/&gt;
1. Once the thread on cursor id X begins to wait for another thread to consume results, it should check back in its session state. Only once it has been signaled to proceed should it re-acquire the session state.&lt;/p&gt;

&lt;p&gt;2. We should somehow set it up so that threads which will consume output of an exchange do not check out the session catalog state (we don&apos;t think they will need it since they do not interact with the storage engine, and further such operations would always be banned from operating within a transaction). Only when the thread has been designated to generate input and partition it or otherwise distribute it among the buffers should it actually check out the session state.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Note we have not observed such a scenario before and also that there may be other possible remedies. This is very related to&#160;the issue described in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-33683&quot; title=&quot;Allow aggregation $mergeCursors stage to run inside a transaction&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-33683&quot;&gt;&lt;del&gt;SERVER-33683&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</description>
                <environment></environment>
        <key id="614827">SERVER-37499</key>
            <summary>Potential deadlock when using exchange within a session</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="ian.boros@mongodb.com">Ian Boros</assignee>
                                    <reporter username="charlie.swanson@mongodb.com">Charlie Swanson</reporter>
                        <labels>
                    </labels>
                <created>Fri, 5 Oct 2018 21:11:29 +0000</created>
                <updated>Sun, 29 Oct 2023 22:27:35 +0000</updated>
                            <resolved>Wed, 19 Dec 2018 23:41:23 +0000</resolved>
                                    <version>4.1.3</version>
                                    <fixVersion>4.1.7</fixVersion>
                                    <component>Aggregation Framework</component>
                                        <votes>0</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="2096680" author="xgen-internal-githook" created="Thu, 20 Dec 2018 01:12:46 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;benety&apos;, &apos;email&apos;: &apos;benety@mongodb.com&apos;, &apos;name&apos;: &apos;Benety Goh&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-37499&quot; title=&quot;Potential deadlock when using exchange within a session&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-37499&quot;&gt;&lt;del&gt;SERVER-37499&lt;/del&gt;&lt;/a&gt; fix lint (stdx)&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/a35cfea6e7443769a1620f2324b4bf933b731ea1&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/a35cfea6e7443769a1620f2324b4bf933b731ea1&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2096646" author="xgen-internal-githook" created="Wed, 19 Dec 2018 23:51:48 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;benety&apos;, &apos;email&apos;: &apos;benety@mongodb.com&apos;, &apos;name&apos;: &apos;Benety Goh&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-37499&quot; title=&quot;Potential deadlock when using exchange within a session&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-37499&quot;&gt;&lt;del&gt;SERVER-37499&lt;/del&gt;&lt;/a&gt; fix lint&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/c959f0d1381baba1bf479c3515122ebfc4c39d45&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/c959f0d1381baba1bf479c3515122ebfc4c39d45&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2096638" author="xgen-internal-githook" created="Wed, 19 Dec 2018 23:40:17 +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-37499&quot; title=&quot;Potential deadlock when using exchange within a session&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-37499&quot;&gt;&lt;del&gt;SERVER-37499&lt;/del&gt;&lt;/a&gt; prevent deadlock within Exchange during transaction&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/4eee17a5fdc14af2c3770b01cc4f906fa3620fe5&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/4eee17a5fdc14af2c3770b01cc4f906fa3620fe5&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2089918" author="charlie.swanson" created="Thu, 13 Dec 2018 18:01:43 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=craig.homa&quot; class=&quot;user-hover&quot; rel=&quot;craig.homa&quot;&gt;craig.homa&lt;/a&gt; ditto concern from the other ticket in this epic - why is this in a February sprint?&lt;/p&gt;</comment>
                            <comment id="2037339" author="charlie.swanson" created="Mon, 22 Oct 2018 14:07:28 +0000"  >&lt;p&gt;We realized after discussion on Friday that this deadlock cannot happen today because (1) the session is only checked out if there is a txnNumber attached to the request and (2) we would ban such a request with a $out, and also more generally any aggregation which involves merging on a shard (&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-33683&quot; title=&quot;Allow aggregation $mergeCursors stage to run inside a transaction&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-33683&quot;&gt;&lt;del&gt;SERVER-33683&lt;/del&gt;&lt;/a&gt;). Because this is not a real issue today, and because it depends on other work outside this epic, I am removing this ticket from the &quot;Improve $out&quot; epic and putting it inside the cross-shard transactions epic with &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-33683&quot; title=&quot;Allow aggregation $mergeCursors stage to run inside a transaction&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-33683&quot;&gt;&lt;del&gt;SERVER-33683&lt;/del&gt;&lt;/a&gt;. The query team is happy to implement when this is unblocked, just let us know and we can try to work it into our schedule.&lt;/p&gt;</comment>
                            <comment id="2036282" author="david.storch" created="Fri, 19 Oct 2018 18:28:50 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=charlie.swanson&quot; class=&quot;user-hover&quot; rel=&quot;charlie.swanson&quot;&gt;charlie.swanson&lt;/a&gt; to clarify expected delivery date for &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-37665&quot; title=&quot;Add interface to check in and check out sessions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-37665&quot;&gt;&lt;del&gt;SERVER-37665&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="621627">SERVER-37665</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="506070">SERVER-33683</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>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_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>Fri, 19 Oct 2018 18:28:50 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        5 years, 8 weeks ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[<s><a href='https://jira.mongodb.org/browse/SERVER-37665'>SERVER-37665</a></s>]]></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-1294</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, 8 weeks 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>charlie.swanson@mongodb.com</customfieldvalue>
            <customfieldvalue>david.storch@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>ian.boros@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hu9nf3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hu687j:</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="2572">Query 2018-12-17</customfieldvalue>
    <customfieldvalue id="2594">Query 2018-12-31</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|hu99of:</customfieldvalue>

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