<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:44:56 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-17570] MongoDB 3.0 NT Service shutdown race condition with db.serverShutdown()</title>
                <link>https://jira.mongodb.org/browse/SERVER-17570</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;There is a crash in mongod while it is being terminated during some of the Automation Agent tests on Windows.  The crash only happens with MongoDB 3.0.  Running the same tests with MongoDB 2.6 or 2.4 does not produce the crash.  Crash dump file is attached.&lt;/p&gt;</description>
                <environment></environment>
        <key id="189238">SERVER-17570</key>
            <summary>MongoDB 3.0 NT Service shutdown race condition with db.serverShutdown()</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="9">Done</resolution>
                                        <assignee username="mark.benvenuto@mongodb.com">Mark Benvenuto</assignee>
                                    <reporter username="david.golub@mongodb.com">David Golub</reporter>
                        <labels>
                    </labels>
                <created>Thu, 12 Mar 2015 18:55:29 +0000</created>
                <updated>Sat, 19 Sep 2015 00:00:23 +0000</updated>
                            <resolved>Wed, 18 Mar 2015 16:48:30 +0000</resolved>
                                    <version>3.0.0</version>
                                    <fixVersion>3.0.2</fixVersion>
                    <fixVersion>3.1.1</fixVersion>
                                    <component>Admin</component>
                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="858315" author="xgen-internal-githook" created="Thu, 19 Mar 2015 20:54:26 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;markbenvenuto&apos;, u&apos;name&apos;: u&apos;Mark Benvenuto&apos;, u&apos;email&apos;: u&apos;mark.benvenuto@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-17570&quot; title=&quot;MongoDB 3.0 NT Service shutdown race condition with db.serverShutdown()&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-17570&quot;&gt;&lt;del&gt;SERVER-17570&lt;/del&gt;&lt;/a&gt;: Fix NT Service shutdown race condition&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 0f6f2e9a199bff05c69ca5aace94a5ac8fe2cff3)&lt;br/&gt;
Branch: v3.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/4e1f873727914b341f9638b1a36fef66cfebfa16&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/4e1f873727914b341f9638b1a36fef66cfebfa16&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="857825" author="mark.benvenuto" created="Thu, 19 Mar 2015 14:49:01 +0000"  >&lt;p&gt;Here are the bug details:&lt;/p&gt;

&lt;p&gt;There are two different execution models for mongod on Windows&lt;br/&gt;
1. Console program&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;wmain() is called on thread 0, and we listen for connections on thread 0&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;2. NT Service&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;wmain() is called on thread 0, then StartServiceCtrlDispatcherW is called, and&lt;br/&gt;
we listen for connections on a thread spawned by sechost.dll such as thread 3&lt;br/&gt;
called ServiceMain. Thread 0 is used for processing NT Service control manager&lt;br/&gt;
events.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;(Note: thread numbers are example thread numbers from a debugger)&lt;/p&gt;

&lt;p&gt;The bug:&lt;/p&gt;

&lt;p&gt;There is a race condition between exitCleanly, and StartServiceCtrlDispatcher&lt;br/&gt;
returning. When exitCleanly is called via CmdShutdown::run,&lt;br/&gt;
StartServiceCtrlDispatcherW returns before exitCleanly finishes, and therefore&lt;br/&gt;
startService calls quickExit. This results in an unclean shtudown.&lt;br/&gt;
StartServiceCtrlDispatcherW returns because initAndListen has finished as a&lt;br/&gt;
result of inShutdown being set to true.&lt;/p&gt;

&lt;p&gt;This does not happen if the process receives a SERVICE_CONTROL_STOP (ie, sc.exe&lt;br/&gt;
stop mongodb), because this event is processed on thread 0, and therefore&lt;br/&gt;
StartServiceCtrlDispatcherW will not return until serviceShutdown is completes&lt;br/&gt;
first.&lt;/p&gt;

&lt;p&gt;The fix:&lt;/p&gt;

&lt;p&gt;1. Create a method called signalShutdown to set inShutdown true so the listener&lt;br/&gt;
loops stop on the ServiceMain thread&lt;br/&gt;
2. Change exitCleanly in mongod to use a lock to provide mutual exclusion&lt;br/&gt;
instead of atomic operations.&lt;br/&gt;
3. Cleanup ntservice.cpp now that signalShutdown exists, and we have made&lt;br/&gt;
initService the only caller of exitCleanly.&lt;/p&gt;</comment>
                            <comment id="856893" author="xgen-internal-githook" created="Wed, 18 Mar 2015 16:40:57 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;markbenvenuto&apos;, u&apos;name&apos;: u&apos;Mark Benvenuto&apos;, u&apos;email&apos;: u&apos;mark.benvenuto@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-17570&quot; title=&quot;MongoDB 3.0 NT Service shutdown race condition with db.serverShutdown()&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-17570&quot;&gt;&lt;del&gt;SERVER-17570&lt;/del&gt;&lt;/a&gt;: Fix NT Service shutdown race condition&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/0f6f2e9a199bff05c69ca5aace94a5ac8fe2cff3&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/0f6f2e9a199bff05c69ca5aace94a5ac8fe2cff3&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                                        </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="67499" name="mongod.exe-(PID-10816).dmp" size="1688329" author="david.golub@mongodb.com" created="Thu, 12 Mar 2015 18:55:29 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.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_12451" key="com.atlassian.jira.plugin.system.customfieldtypes:multiversion">
                        <customfieldname>Backport Completed</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="15180">3.0.2</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10011"><![CDATA[Minor Change]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 12 Mar 2015 19:42:34 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        8 years, 47 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>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            8 years, 47 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>david.golub@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>mark.benvenuto@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrlatz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hs72rr:</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="452">Platform 1 04/03/15</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_11861" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>User Summary</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="11856"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hsg77z:</customfieldvalue>

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