<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:19: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-28861] Coverity analysis defect 100779: Thread deadlock</title>
                <link>https://jira.mongodb.org/browse/SERVER-28861</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Threads may try to acquire two locks in different orders, potentially causing deadlock&lt;/p&gt;

&lt;p&gt;Defect 100779 (STATIC_C)&lt;br/&gt;
  Checker ORDER_REVERSAL (subcategory none)&lt;br/&gt;
  File:  &lt;tt&gt;/src/mongo/db/logical_clock.cpp&lt;/tt&gt;&lt;br/&gt;
  Function &lt;tt&gt;mongo::LogicalClock::reserveTicks(unsigned long)&lt;/tt&gt;&lt;/p&gt;
</description>
                <environment></environment>
        <key id="375448">SERVER-28861</key>
            <summary>Coverity analysis defect 100779: Thread deadlock</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="backlog-server-sharding">[DO NOT USE] Backlog - Sharding Team</assignee>
                                    <reporter username="xgen-internal-coverity">Coverity Collector User</reporter>
                        <labels>
                            <label>coverity</label>
                            <label>neweng</label>
                    </labels>
                <created>Wed, 19 Apr 2017 14:43:57 +0000</created>
                <updated>Tue, 6 Dec 2022 04:02:55 +0000</updated>
                            <resolved>Thu, 2 Jan 2020 14:30:44 +0000</resolved>
                                                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="2698302" author="sheeri.cabral" created="Thu, 2 Jan 2020 14:30:45 +0000"  >&lt;p&gt;This is a valid bug but the mock is used in single-threaded unit tests, and not seen in the wild or in testing.&lt;/p&gt;</comment>
                            <comment id="1732183" author="misha.tyulenev" created="Tue, 21 Nov 2017 21:10:06 +0000"  >&lt;p&gt;Moving to Backlog as this is an issue that is not possible for production code because the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/v3.6/src/mongo/util/background_thread_clock_source.cpp#L71&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;BackgroundThreadClockSource::now() &lt;/a&gt;  does not use mutexes its an atomic.&lt;/p&gt;

&lt;p&gt;The suggested fix should change the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/v3.6/src/mongo/util/clock_source_mock.h#L72&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;ClockSourceMock::_now&lt;/a&gt; to an atomic implementation so it will not need mutexes.&lt;/p&gt;</comment>
                            <comment id="1620457" author="spencer" created="Wed, 12 Jul 2017 20:40:20 +0000"  >&lt;p&gt;Assigning to sharding team since this involves the LogicalClock&lt;/p&gt;</comment>
                            <comment id="1615377" author="william.schultz" created="Thu, 6 Jul 2017 16:40:53 +0000"  >&lt;p&gt;The issue Coverity picked up on has to deal with inconsistent lock acquisition order, involving the &lt;tt&gt;LogicalClock::_mutex&lt;/tt&gt; and the &lt;tt&gt;NetworkInterfaceMock::_mutex&lt;/tt&gt;, leading to a potential deadlock. Consider the following two functions, and the order that they acquire locks:&lt;/p&gt;

&lt;h5&gt;&lt;a name=&quot;%7B%7BLogicalClock%3A%3AreserveTicks%7D%7D&quot;&gt;&lt;/a&gt;&lt;tt&gt;LogicalClock::reserveTicks&lt;/tt&gt;&lt;/h5&gt;
&lt;ol&gt;
	&lt;li&gt;Acquire &lt;tt&gt;LogicalClock::_mutex&lt;/tt&gt; (&lt;a href=&quot;https://github.com/mongodb/mongo/blob/3ea2d70f0260b1ec6ec8c60d42d6a6669a802ef2/src/mongo/db/logical_clock.cpp#L118&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;code &lt;/a&gt;)&lt;/li&gt;
	&lt;li&gt;Acquire &lt;tt&gt;NetworkInterfaceMock::_mutex&lt;/tt&gt; (&lt;a href=&quot;https://github.com/mongodb/mongo/blob/3ea2d70f0260b1ec6ec8c60d42d6a6669a802ef2/src/mongo/db/logical_clock.cpp#L123&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;code &lt;/a&gt;)&lt;/li&gt;
&lt;/ol&gt;


&lt;h5&gt;&lt;a name=&quot;%7B%7BNetworkInterfaceMock%3A%3AscheduleResponse%7D%7D&quot;&gt;&lt;/a&gt;&lt;tt&gt;NetworkInterfaceMock::_scheduleResponse&lt;/tt&gt;&lt;/h5&gt;
&lt;ol&gt;
	&lt;li&gt;Acquire &lt;tt&gt;NetworkInterfaceMock::_mutex&lt;/tt&gt; (&lt;a href=&quot;https://github.com/mongodb/mongo/blob/3ea2d70f0260b1ec6ec8c60d42d6a6669a802ef2/src/mongo/executor/network_interface_mock.cpp#L301&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;code &lt;/a&gt;)&lt;/li&gt;
	&lt;li&gt;Acquire &lt;tt&gt;LogicalClock::_mutex&lt;/tt&gt; (&lt;a href=&quot;https://github.com/mongodb/mongo/blob/3ea2d70f0260b1ec6ec8c60d42d6a6669a802ef2/src/mongo/executor/network_interface_mock.cpp#L311&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;code &lt;/a&gt;, &lt;a href=&quot;https://github.com/mongodb/mongo/blob/3ea2d70f0260b1ec6ec8c60d42d6a6669a802ef2/src/mongo/db/logical_time_metadata_hook.cpp#L78&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;readReplyFromMetadata &lt;/a&gt;)&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Since these two functions acquire the same two locks but in reverse orders, it creates the potential for a deadlock, if each of these functions are running on separate threads and try to acquire the locks with a specific thread interleaving. I presume that the NetworkInterfaceMock would only be used for testing, and so is not a serious issue.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4.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_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25141"><![CDATA[Sharding]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 6 Jul 2017 16:40:53 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 5 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_14262" key="com.atlassian.jira.plugin.system.customfieldtypes:datepicker">
                        <customfieldname>End date</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 26 Sep 2017 23:59:59 +0000</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>alexander.golin@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            4 years, 5 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>backlog-server-sharding</customfieldvalue>
            <customfieldvalue>xgen-internal-coverity</customfieldvalue>
            <customfieldvalue>misha.tyulenev@mongodb.com</customfieldvalue>
            <customfieldvalue>sheeri.cabral</customfieldvalue>
            <customfieldvalue>spencer@mongodb.com</customfieldvalue>
            <customfieldvalue>william.schultz@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|ht61p3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|ht0iyv:</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="1891">Sharding 2017-10-02</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_14261" key="com.atlassian.jira.plugin.system.customfieldtypes:datepicker">
                        <customfieldname>Start date</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 19 Apr 2017 00:00:00 +0000</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|hrs4un:</customfieldvalue>

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