<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:33:40 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-33522] Possible to call TaskExecutor::signalEvent twice during shutdown</title>
                <link>https://jira.mongodb.org/browse/SERVER-33522</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;When a mongos shuts down, it only attempts to join with client threads &lt;a href=&quot;https://github.com/mongodb/mongo/blob/4a69dcaf78f29cf440ada961c7e59de6b5dde111/src/mongo/s/server.cpp#L247-L253&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;when ASAN is enabled&lt;/a&gt;, and even then, it does so with a timeout before exiting the process. Before this happens, it calls &lt;tt&gt;shutdownAndJoin&lt;/tt&gt; on the &lt;tt&gt;TaskExecutorPool&lt;/tt&gt;. Therefore, client threads may still be running while the &lt;tt&gt;ThreadPoolTaskExecutor&lt;/tt&gt; is in a call to &lt;tt&gt;join()&lt;/tt&gt;. If &lt;tt&gt;join()&lt;/tt&gt; completes (and as part of completing, &lt;a href=&quot;https://github.com/mongodb/mongo/blob/4a69dcaf78f29cf440ada961c7e59de6b5dde111/src/mongo/executor/thread_pool_task_executor.cpp#L200-L206&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;signals all of the unsignaled events&lt;/a&gt;) just before a client thread tries to signal an event, the client thread will signal the event for a second time, and &lt;a href=&quot;https://github.com/mongodb/mongo/blob/4a69dcaf78f29cf440ada961c7e59de6b5dde111/src/mongo/executor/thread_pool_task_executor.cpp#L514&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;trigger an&lt;/a&gt; &lt;tt&gt;invariant()&lt;/tt&gt;. I believe this is a bug (rather than a misuse) of &lt;tt&gt;TaskExecutor&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;One way to solve this would be to make &lt;tt&gt;signalEvent()&lt;/tt&gt; a no-op when the TaskExecutor is in shutdown. This way we guarantee every event is signaled exactly once: Either it is signaled before shutdown, or it is signaled as part of shutdown, and all subsequent calls to &lt;tt&gt;signalEvent()&lt;/tt&gt; don&apos;t do anything.&lt;/p&gt;

&lt;p&gt;Another way of solving this would be to change the order of shutdown, so that we join with all client threads before shutting down the TaskExecutor. Right now, we don&apos;t even attempt to join with client threads &lt;a href=&quot;https://github.com/mongodb/mongo/blob/4a69dcaf78f29cf440ada961c7e59de6b5dde111/src/mongo/s/server.cpp#L247-L253&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;unless we&apos;re running under ASAN&lt;/a&gt;, and even then, we do so with a timeout, so this would be a significant change.&lt;/p&gt;

&lt;p&gt;I believe this problem is the cause of:&lt;br/&gt;
&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-25497&quot; title=&quot;Fix sharded query path to handle shutdown of the mongos process&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-25497&quot;&gt;&lt;del&gt;SERVER-25497&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AC: Choose one of the two proposed solutions (or a potential third?).&lt;/p&gt;</description>
                <environment></environment>
        <key id="503086">SERVER-33522</key>
            <summary>Possible to call TaskExecutor::signalEvent twice during shutdown</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="amirsaman.memaripour@mongodb.com">Amirsaman Memaripour</assignee>
                                    <reporter username="ian.boros@mongodb.com">Ian Boros</reporter>
                        <labels>
                    </labels>
                <created>Tue, 27 Feb 2018 18:30:42 +0000</created>
                <updated>Sun, 29 Oct 2023 22:34:23 +0000</updated>
                            <resolved>Wed, 18 May 2022 21:13:51 +0000</resolved>
                                                    <fixVersion>6.1.0-rc0</fixVersion>
                                    <component>Internal Code</component>
                                        <votes>0</votes>
                                    <watches>12</watches>
                                                                                                                <comments>
                            <comment id="4557930" author="xgen-internal-githook" created="Wed, 18 May 2022 21:12:59 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Amirsaman Memaripour&apos;, &apos;email&apos;: &apos;amirsaman.memaripour@mongodb.com&apos;, &apos;username&apos;: &apos;samanca&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-33522&quot; title=&quot;Possible to call TaskExecutor::signalEvent twice during shutdown&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-33522&quot;&gt;&lt;del&gt;SERVER-33522&lt;/del&gt;&lt;/a&gt; Skip `TaskExecutor::signalEvent` when shutdown is in progress&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/48610db5accc050ca732f5533bd99bd2bebcf59f&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/48610db5accc050ca732f5533bd99bd2bebcf59f&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4468224" author="max.hirschhorn@10gen.com" created="Fri, 8 Apr 2022 17:00:33 +0000"  >&lt;p&gt;Reopening this ticket because server crashes at shutdown are undesirable and lead to scary&amp;#45;looking backtraces in server logs of our end users.&lt;/p&gt;</comment>
                            <comment id="4375672" author="JIRAUSER1262719" created="Thu, 24 Feb 2022 21:55:33 +0000"  >&lt;p&gt;We haven&#8217;t heard back from you for at least one calendar year, so this issue is being closed. If this is still an issue for you, please provide additional information and we will reopen the ticket.&lt;/p&gt;</comment>
                            <comment id="3445766" author="ruoxin.xu" created="Thu, 15 Oct 2020 10:12:14 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=matthew.tretin&quot; class=&quot;user-hover&quot; rel=&quot;matthew.tretin&quot;&gt;matthew.tretin&lt;/a&gt; The patch for &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-25497&quot; title=&quot;Fix sharded query path to handle shutdown of the mongos process&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-25497&quot;&gt;&lt;del&gt;SERVER-25497&lt;/del&gt;&lt;/a&gt; is not making any change in TaskExecutor but in AsyncResultsMerger(ARM) to avoid race conditions where the underlying TaskExecutor and AsyncResultsMerger are simultaneously being shut down by using std::promise/future instead of TaskExecutor &apos;event&apos; mechanism in ARM, which should be able to fix the problem in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-25497&quot; title=&quot;Fix sharded query path to handle shutdown of the mongos process&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-25497&quot;&gt;&lt;del&gt;SERVER-25497&lt;/del&gt;&lt;/a&gt;. This ticket, IIUC, is for the potential multiple calls to TaskExecutor::signalEvent(), possibly a bug of TaskExecutor.&lt;/p&gt;</comment>
                            <comment id="3440441" author="JIRAUSER1254107" created="Mon, 12 Oct 2020 20:45:47 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ruoxin.xu&quot; class=&quot;user-hover&quot; rel=&quot;ruoxin.xu&quot;&gt;ruoxin.xu&lt;/a&gt;&#160;Do you think your CR for &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-25497&quot; title=&quot;Fix sharded query path to handle shutdown of the mongos process&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-25497&quot;&gt;&lt;del&gt;SERVER-25497&lt;/del&gt;&lt;/a&gt; will take care of it?&#160;&lt;/p&gt;</comment>
                            <comment id="1818555" author="schwerin" created="Wed, 28 Feb 2018 15:12:09 +0000"  >&lt;p&gt;Oh, yeah, when I built the TaskExecutor, I didn&apos;t really consider Events that would be signaled from outside of Callbacks while working out the shutdown logic.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="307412">SERVER-25497</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>1.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, 28 Feb 2018 15:12:09 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        1 year, 38 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>
                            1 year, 38 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>amirsaman.memaripour@mongodb.com</customfieldvalue>
            <customfieldvalue>schwerin@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>ian.boros@mongodb.com</customfieldvalue>
            <customfieldvalue>lauren.lewis@mongodb.com</customfieldvalue>
            <customfieldvalue>matthew.tretin@mongodb.com</customfieldvalue>
            <customfieldvalue>max.hirschhorn@mongodb.com</customfieldvalue>
            <customfieldvalue>ruoxin.xu@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|htr9i7:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr9fen:</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_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="6263">Service Arch 2022-05-30</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|htqvof:</customfieldvalue>

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