<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:17:16 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-48490] Destroy the ServiceContext on clean shutdown</title>
                <link>https://jira.mongodb.org/browse/SERVER-48490</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The MongoD, MongoS and DBTest processes create a ServiceContext at initialisation time, but never destroy it. This means a lot of internal services, which hang off the ServiceContext and use the Construction/Destruction actions do not actually get shut down.&lt;/p&gt;

&lt;p&gt;In the case of non-SAN builds, this is expected and valuable (because the time it takes to fully unwind all client stacks is long, and end users don&apos;t benefit from waiting), but for SAN builds we already unwind stacks, so also destroying the service context is completely acceptable.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1366638">SERVER-48490</key>
            <summary>Destroy the ServiceContext on clean 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="3">Duplicate</resolution>
                                        <assignee username="backlog-server-servicearch">Backlog - Service Architecture</assignee>
                                    <reporter username="kaloian.manassiev@mongodb.com">Kaloian Manassiev</reporter>
                        <labels>
                            <label>thread-sanitizer</label>
                    </labels>
                <created>Fri, 29 May 2020 14:16:57 +0000</created>
                <updated>Mon, 8 Jan 2024 15:23:17 +0000</updated>
                            <resolved>Tue, 22 Jun 2021 17:27:34 +0000</resolved>
                                    <version>4.4.0-rc7</version>
                                                    <component>Internal Code</component>
                                        <votes>0</votes>
                                    <watches>9</watches>
                                                                                                                <comments>
                            <comment id="3997578" author="xgen-internal-githook" created="Thu, 12 Aug 2021 15:19:29 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;George Wangensteen&apos;, &apos;email&apos;: &apos;george.wangensteen@mongodb.com&apos;, &apos;username&apos;: &apos;gewa24&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-57984&quot; title=&quot;Complete TODO listed in SERVER-48490&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-57984&quot;&gt;&lt;del&gt;SERVER-57984&lt;/del&gt;&lt;/a&gt; Update references to &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48490&quot; title=&quot;Destroy the ServiceContext on clean shutdown&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-48490&quot;&gt;&lt;del&gt;SERVER-48490&lt;/del&gt;&lt;/a&gt; to &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-52413&quot; title=&quot;Enable feature flag for Global clean shutdown&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-52413&quot;&gt;&lt;del&gt;SERVER-52413&lt;/del&gt;&lt;/a&gt; which marks completion of global clean shutdown work&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/d9f51262487d11e03272bb403efae2b6aff114d7&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/d9f51262487d11e03272bb403efae2b6aff114d7&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3892051" author="ratika.gandhi" created="Tue, 22 Jun 2021 17:27:23 +0000"  >&lt;p&gt;We will take care of this in the larger project for global clean shutdown (PM-774) so we are closing this ticket.&#160;&lt;/p&gt;</comment>
                            <comment id="3343629" author="xgen-internal-githook" created="Mon, 17 Aug 2020 23:45:58 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Andrew Morrow&apos;, &apos;email&apos;: &apos;acm@mongodb.com&apos;, &apos;username&apos;: &apos;acmorrow&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48490&quot; title=&quot;Destroy the ServiceContext on clean shutdown&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-48490&quot;&gt;&lt;del&gt;SERVER-48490&lt;/del&gt;&lt;/a&gt; Suppress thread_leak errors under TSAN&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/99e85a18ec8a12c5988fe03ad83e0f064cc6dd6f&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/99e85a18ec8a12c5988fe03ad83e0f064cc6dd6f&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3312875" author="ryan.egesdahl" created="Wed, 29 Jul 2020 20:38:50 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=daniel.gottlieb&quot; class=&quot;user-hover&quot; rel=&quot;daniel.gottlieb&quot;&gt;daniel.gottlieb&lt;/a&gt; Sorry, I should have been more clear - my point wasn&apos;t about performance but to point out the fact that we&apos;re relying on undefined behavior. I mentioned performance because the choices in this test are to either accept the undefined behavior for the sake of test performance or to do it the &quot;right way&quot; for the test. Either choice has tradeoffs. I agree with &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=acm&quot; class=&quot;user-hover&quot; rel=&quot;acm&quot;&gt;acm&lt;/a&gt; that we should not be doing this in the codebase in any case for the reasons he stated, and I think the real point of this test is to demonstrate why that is the case and to get us thinking about how we can make progress towards undoing the history that got us here and what (if anything) on our list of priorities requires it.&lt;/p&gt;</comment>
                            <comment id="3312853" author="acm" created="Wed, 29 Jul 2020 20:30:22 +0000"  >&lt;p&gt;I&apos;ll add that while there may be good technical arguments in favor of doing a fast-path shutdown in production, it should be possible to do a clean shutdown by calling &lt;tt&gt;exit&lt;/tt&gt;, or, better, returning from &lt;tt&gt;main&lt;/tt&gt;. The fact that the mongodb codebase is unable to do so is a defect, and our long reliance on invoking &lt;tt&gt;_exit&lt;/tt&gt; to work around that defect has only allowed that defect to metastasize unfettered throughout the codebase. It is now pervasive. Any work that moves us in the direction of being closer to achieving a clean exit is laudable. We will not, for instance, be able to serially instantiate multiple server instances within one address space without first being able to repeatedly create, run, and destroy such servers without terminating the process. Similarly, we will not be able to concurrently instantiate multiple independent server instances in an address space without first decoupling them from global mutable state.&lt;/p&gt;</comment>
                            <comment id="3312818" author="acm" created="Wed, 29 Jul 2020 20:15:42 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=daniel.gottlieb&quot; class=&quot;user-hover&quot; rel=&quot;daniel.gottlieb&quot;&gt;daniel.gottlieb&lt;/a&gt; - It isn&apos;t clearly stated here, but the scope of this is to do a more complete shutdown when running under one of the sanitizers. In those cases, the cost of shutdown should not be an issue.&lt;/p&gt;</comment>
                            <comment id="3312760" author="daniel.gottlieb@10gen.com" created="Wed, 29 Jul 2020 19:50:29 +0000"  >&lt;p&gt;Presumably if we&apos;re going to cleanup service contexts and their decorations on shutdown, we should be doing the same for WT?&lt;/p&gt;

&lt;p&gt;Production releases tell &lt;a href=&quot;https://github.com/mongodb/mongo/blob/1dfde3f7a6ada7440c90301843e8b60335fb800c/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp#L910-L919&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;WT to leak memory on clean shutdown&lt;/a&gt; and have done so for as long as I can remember. To free memory, WT has to do a lot of pointer chasing. It might be easier to measure the effects of flipping that configuration on a system that&apos;s paged in a lot of data (10s of gigabytes worth of 1KB documents) to get a measurement. I believe that setting exists because shutdown was found to be slow, but if someone wants to make a case that it&apos;s not slow they should certainly feel free to remeasure.&lt;/p&gt;</comment>
                            <comment id="3312723" author="ryan.egesdahl" created="Wed, 29 Jul 2020 19:32:46 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=mira.carey%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;mira.carey@mongodb.com&quot;&gt;mira.carey@mongodb.com&lt;/a&gt; You should be aware that in the case of Linux (and really any POSIX system), processes are &lt;b&gt;required&lt;/b&gt; to clean up their messes before they exit. If we just do a quick exit, there&apos;s no guarantee on when the OS will reap resources. For Linux, that&apos;s how overcommit is designed to work, in fact - it&apos;s supposed to be lazy, and the memory will likely only be reclaimed once enough pressure is placed on the system, at which point it may start swapping pages out to disk before dropping the LRU ones. Opportunistic memory reclaim has been a topic of conversation within the Linux kernel community for years now, but it has never really made much headway: &lt;a href=&quot;https://lwn.net/Articles/785633/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://lwn.net/Articles/785633/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do we have data on the claim that we save significant amounts of time and/or other resources during restarts with this approach? From a systems perspective, I strongly recommend against continuing the drop-all-and-die practice we&apos;ve been doing unless there is some &lt;b&gt;serious&lt;/b&gt; savings to be had, and even then I would consider that to be a problem to fix. This is undefined behavior in the *NIX world. I don&apos;t know about the Windows world, but I can&apos;t help but think it is there as well.&lt;/p&gt;</comment>
                            <comment id="3147057" author="jason.carey" created="Fri, 29 May 2020 20:56:51 +0000"  >&lt;p&gt;I&apos;m not sure we really want to do this.  We&apos;ve long had a stance of taking advantage of quickExit to shutdown the server (assuming it&apos;s going to be faster to restart a process by letting the os reclaim memory and file handles, rather than doing it ourselves), and destroying the ServiceContext during a normal exit implies waiting for much much longer than we do today.  Specifically, we&apos;ll have to wait for every outstanding operation context  to be destroyed, which will require us to unwind all user stacks.&lt;/p&gt;

&lt;p&gt;One area I might consider this for would be in address sanitizer builds, which I believe do at least attempt to shutdown the service executor (which waits on unwinding all user stacks).  Or perhaps under a special flag. &lt;/p&gt;

&lt;p&gt;I&apos;m just a little skeptical of the value in doing this, for our end users, in all production binaries all of the time&lt;/p&gt;
</comment>
                            <comment id="3142691" author="kaloian.manassiev" created="Fri, 29 May 2020 14:17:56 +0000"  >&lt;p&gt;I am going to take a first stab at investigating how to improve the Shutdown procedure.&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="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                                        </outwardlinks>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="1415759">SERVER-49759</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="1415797">SERVER-49762</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1793560">SERVER-57984</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>10.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25132"><![CDATA[Service Arch]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="21777"><![CDATA[v5.0]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 29 May 2020 20:56:51 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        2 years, 25 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_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>
                            2 years, 25 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>11.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>andrew.morrow@mongodb.com</customfieldvalue>
            <customfieldvalue>backlog-server-servicearch</customfieldvalue>
            <customfieldvalue>daniel.gottlieb@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>kaloian.manassiev@mongodb.com</customfieldvalue>
            <customfieldvalue>mira.carey@mongodb.com</customfieldvalue>
            <customfieldvalue>ratika.gandhi@mongodb.com</customfieldvalue>
            <customfieldvalue>ryan.egesdahl@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hxnp6n:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hxawlz:</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_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|hxnbfz:</customfieldvalue>

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