<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:47:12 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-59419] OperationContext::_ignoreInterrupts can be written to without synchronization by IgnoreInterruptionsGuard destructor</title>
                <link>https://jira.mongodb.org/browse/SERVER-59419</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/f8b20f1c3cbde42c92b0f4fcf8274586afd71e8c/src/mongo/util/interruptible.h#L217&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;Interruptible::IgnoreInterruptionsGuard&lt;/tt&gt; calls &lt;tt&gt;Interruptible::popIgnoreInterrupts&lt;/tt&gt; in its destructor&lt;/a&gt;, and Interruptible:: pushIgnoreInterrupts in its constructor,&#160;which, in the case of an &lt;tt&gt;OperationContext&lt;/tt&gt;, results in &lt;a href=&quot;https://github.com/mongodb/mongo/blob/f8b20f1c3cbde42c92b0f4fcf8274586afd71e8c/src/mongo/db/operation_context.h#L601&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&#160;writes to &lt;tt&gt;OperationContext::_ignoreInterrupts&lt;/tt&gt;&lt;/a&gt; that are not explicitly synchronized.&lt;/p&gt;

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

&lt;p&gt;The fundamental issue is that OperationContext: ignoreInterrupts can be written to by {pop,push}IgnoreInterrupts without any synchronization by the client-thread via runWithoutInterruption, but it can be read by other threads via getKillStatus. For example, _ignoreInterrupts can be concurrently read in CurOp::reportCurrentOpForClient, resulting in a data race. Since _ignoreInterrupts is a private member of opCtx and running without interruption is done by the Client thread, this should probably be synchronized via the Client lock. Callers of getKillStatus that are not the client thread (such as CurOp::reportCurrentOpForClient) do indeed take the Client lock before reading _ignoreInterrupts already.&lt;/p&gt;

&lt;p&gt;The general semantics for how the client lock protects these sorts of data races is that while the client-thread is entitled to _read certain opCtx data members lock-free, it still needs to hold the client-lock to write those data members. Conversely, non-client-threads can only read an opCtx&apos;s data when holding the client lock, and can never write these fields (the exception is _killCode, which other threads can write to, which has its own atomic synchronization).&lt;/p&gt;

&lt;p&gt;The reason there is a data race here is because this contract is broken for _ignoreInterrupts, as the client-thread writes to it without holding the client lock. So I think the &apos;right way&apos; to solve this is probably to make sure that {push/pop}IgnoreInterrupts holds the Client lock and can only be called by the client-thread.&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1854209">SERVER-59419</key>
            <summary>OperationContext::_ignoreInterrupts can be written to without synchronization by IgnoreInterruptionsGuard destructor</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="george.wangensteen@mongodb.com">George Wangensteen</assignee>
                                    <reporter username="gregory.noma@mongodb.com">Gregory Noma</reporter>
                        <labels>
                            <label>sa-remove-fv-backlog-22</label>
                    </labels>
                <created>Wed, 18 Aug 2021 15:19:45 +0000</created>
                <updated>Sun, 29 Oct 2023 21:49:26 +0000</updated>
                            <resolved>Thu, 9 Feb 2023 19:28:36 +0000</resolved>
                                                    <fixVersion>7.0.0-rc0</fixVersion>
                    <fixVersion>5.0.21</fixVersion>
                                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="5617165" author="xgen-internal-githook" created="Mon, 7 Aug 2023 14:48:33 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Adityavardhan Agrawal&apos;, &apos;email&apos;: &apos;adi.agrawal@mongodb.com&apos;, &apos;username&apos;: &apos;Adityav369&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-59419&quot; title=&quot;OperationContext::_ignoreInterrupts can be written to without synchronization by IgnoreInterruptionsGuard destructor&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-59419&quot;&gt;&lt;del&gt;SERVER-59419&lt;/del&gt;&lt;/a&gt; Move runWithoutInterruptionExceptAtGlobalShutdown to OperationContext, and then synchronize access to OperationContext::_ingoreInterrupts via the Client lock&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 09df7a4b893a2b3d3bcefbf8c49767bac244f99c)&lt;br/&gt;
Branch: v5.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/45a924bec0534b36e0d6dd2eda5687aa21b88173&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/45a924bec0534b36e0d6dd2eda5687aa21b88173&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5180698" author="xgen-internal-githook" created="Wed, 8 Feb 2023 22:51:32 +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-59419&quot; title=&quot;OperationContext::_ignoreInterrupts can be written to without synchronization by IgnoreInterruptionsGuard destructor&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-59419&quot;&gt;&lt;del&gt;SERVER-59419&lt;/del&gt;&lt;/a&gt; Move runWithoutInterruptionExceptAtGlobalShutdown to OperationContext, and then synchronize access to OperationContext::_ingoreInterrupts via the Client lock&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/09df7a4b893a2b3d3bcefbf8c49767bac244f99c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/09df7a4b893a2b3d3bcefbf8c49767bac244f99c&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4065866" author="gregory.noma" created="Thu, 16 Sep 2021 15:07:36 +0000"  >&lt;p&gt;CC &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=george.wangensteen&quot; class=&quot;user-hover&quot; rel=&quot;george.wangensteen&quot;&gt;george.wangensteen&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4063921" author="gregory.noma" created="Wed, 15 Sep 2021 18:28:24 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=schwerin&quot; class=&quot;user-hover&quot; rel=&quot;schwerin&quot;&gt;schwerin&lt;/a&gt; Yes, &lt;tt&gt;CurOp&lt;/tt&gt; reads this value by &lt;a href=&quot;https://github.com/mongodb/mongo/blob/899b5a9dab4d600ef2ecbe90a1df79b0db5f64f1/src/mongo/db/curop.cpp#L238&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;calling &lt;tt&gt;OperationContext::isKillPending&lt;/tt&gt; in &lt;tt&gt;CurOp::reportCurrentOpForClient&lt;/tt&gt;&lt;/a&gt;, which in turn calls &lt;tt&gt;OperationContext::getKillStatus&lt;/tt&gt;.&lt;/p&gt;</comment>
                            <comment id="4063919" author="schwerin" created="Wed, 15 Sep 2021 18:28:16 +0000"  >&lt;p&gt;Ah, I see. The problem is &lt;a href=&quot;https://github.com/mongodb/mongo/blob/master/src/mongo/db/operation_context.h#L370-L375&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;OperationContext::getKillStatus&lt;/tt&gt;&lt;/a&gt; accesses &lt;tt&gt;_ignoreInterrupts&lt;/tt&gt;, and may be legally called from any thread, yes?&lt;/p&gt;</comment>
                            <comment id="4063894" author="schwerin" created="Wed, 15 Sep 2021 18:23:13 +0000"  >&lt;p&gt;For clarification, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=gregory.noma&quot; class=&quot;user-hover&quot; rel=&quot;gregory.noma&quot;&gt;gregory.noma&lt;/a&gt;, what code &lt;em&gt;reads&lt;/em&gt; &lt;tt&gt;OperationContext::_ignoreInterrupts&lt;/tt&gt; from other threads?&lt;/p&gt;</comment>
                            <comment id="4007236" author="louis.williams" created="Wed, 18 Aug 2021 18:26:17 +0000"  >&lt;p&gt;I would loop in Service Architecture to make sure they approve of the solution. I thought we used the Client lock to prevent these types of races. I&apos;m surprised to see that we aren&apos;t doing that here.&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>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>7.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="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="25376"><![CDATA[v6.3]]></customfieldvalue>
    <customfieldvalue key="21777"><![CDATA[v5.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, 18 Aug 2021 18:26:17 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        26 weeks, 2 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_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>
                            26 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>120.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>schwerin@mongodb.com</customfieldvalue>
            <customfieldvalue>george.wangensteen@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>gregory.noma@mongodb.com</customfieldvalue>
            <customfieldvalue>louis.williams@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hzy84v:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr4buv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_22250" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Special Downgrade Instructions Required</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="23343"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="6749">Service Arch 2023-02-06</customfieldvalue>
    <customfieldvalue id="6750">Service Arch 2023-02-20</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|hzxudr:</customfieldvalue>

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