<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:12:46 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-69178] Interruptible::waitForConditionOrInterruptUntil: Add support for condvar wait without predicate</title>
                <link>https://jira.mongodb.org/browse/SERVER-69178</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;As part of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-68854&quot; title=&quot;Fix deadlock in SchedulingTicketHolder&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-68854&quot;&gt;&lt;del&gt;SERVER-68854&lt;/del&gt;&lt;/a&gt; we found that the current interface for waiting on a condition variable of &lt;a href=&quot;https://github.com/mongodb/mongo/blob/41d0a45aaf90b8e4e9a91f13a72e5623ecd963c4/src/mongo/util/interruptible.h#L359&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;Interruptible::waitForConditionOrInterruptUntil&lt;/tt&gt;&lt;/a&gt; is cumbersome and not really appropriate if the act of a thread waking up has to have side-effects.&lt;/p&gt;

&lt;p&gt;This ticket is about exposing an interface for such cases where you can wait without a predicate, exposing yourself to spurious wake-ups.&lt;/p&gt;</description>
                <environment></environment>
        <key id="2122880">SERVER-69178</key>
            <summary>Interruptible::waitForConditionOrInterruptUntil: Add support for condvar wait without predicate</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="1" iconUrl="https://jira.mongodb.org/images/icons/statuses/open.png" description="">Open</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="backlog-server-servicearch">Backlog - Service Architecture</assignee>
                                    <reporter username="jordi.olivares-provencio@mongodb.com">Jordi Olivares Provencio</reporter>
                        <labels>
                    </labels>
                <created>Fri, 26 Aug 2022 10:00:08 +0000</created>
                <updated>Mon, 5 Dec 2022 23:48:11 +0000</updated>
                                                                                                <votes>0</votes>
                                    <watches>8</watches>
                                                                                                                <comments>
                            <comment id="4805430" author="jason.chan" created="Tue, 6 Sep 2022 17:34:42 +0000"  >&lt;p&gt;Putting this in top priority to investigate within the next sprint&lt;/p&gt;</comment>
                            <comment id="4787866" author="JIRAUSER1264163" created="Tue, 30 Aug 2022 13:36:02 +0000"  >&lt;p&gt;We are indeed implementing a semaphore, but with scheduling support. We couldn&apos;t use any existing implementation since it&apos;s quite tailored to this use-case.&lt;/p&gt;</comment>
                            <comment id="4784532" author="billy.donahue" created="Mon, 29 Aug 2022 17:00:25 +0000"  >&lt;p&gt;I still don&apos;t get it. The operation you&apos;re describing sounds like a semaphore, not a condition variable. Would that be a better fit for you?&lt;/p&gt;

&lt;p&gt;I feel like condition variable does what it&apos;s designed to do, and this is not that.&lt;/p&gt;</comment>
                            <comment id="4783046" author="JIRAUSER1264163" created="Mon, 29 Aug 2022 09:10:12 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=billy.donahue%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;billy.donahue@mongodb.com&quot;&gt;billy.donahue@mongodb.com&lt;/a&gt; To clarify, in that ticket we still check some conditions (a predicate if you want) before deciding to wait again or not. The thing is that we need to do some extra work before proceeding to wait again.&lt;/p&gt;

&lt;p&gt;The principle behind the phrase &quot;just the simple act of waking the thread has to have side effects&quot; is due to a required feature in the ticket where we need to implement our own version of &lt;tt&gt;cv.notify_one()&lt;/tt&gt; that returns whether it will wake a thread up or not. To do this we have a counter that goes up with notifies and down to 0 with threads waking from the notifications. This is the reason why we can&apos;t use the current interface as we have no control of this side effect of waking.&lt;/p&gt;

&lt;p&gt;It could be argued that this should be a method of the condition_variable object, but it might be quite complex to implement in general without knowledge of how it&apos;s going to be used.&lt;/p&gt;</comment>
                            <comment id="4780597" author="billy.donahue" created="Fri, 26 Aug 2022 19:55:11 +0000"  >&lt;blockquote&gt;
&lt;p&gt;For &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-68854&quot; title=&quot;Fix deadlock in SchedulingTicketHolder&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-68854&quot;&gt;&lt;del&gt;SERVER-68854&lt;/del&gt;&lt;/a&gt;, the use-case requires only waking the thread if there&apos;s a timeout or the condition variable is notified, not if the predicate evaluates to true &lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;That sounds like a misuse of condition_variable notifications. The notification is nothing but a means of getting waiters to look at other conditions and data to determine whether to wake up. The notify is never itself something to respond to directly. Waiting with or without a predicate is a style choice. If you don&apos;t choose to use a predicate you&apos;re still expected to check other conditions and data warrant the wakeup of your thread or whether it should relock and go back to sleep.&lt;/p&gt;

&lt;p&gt;In either case the action you want the thread to take on wakeup should not happen until the condition of the condition variable is satisfied or timeout has been reached.&lt;/p&gt;

&lt;p&gt;&quot;just the simple act of waking the thread has to have side effects&quot;&lt;/p&gt;

&lt;p&gt;is the most important thing about this ticket and I would like to understand it before digging deeper.&lt;/p&gt;</comment>
                            <comment id="4780041" author="billy.donahue" created="Fri, 26 Aug 2022 17:02:58 +0000"  >&lt;p&gt;Thanks for clarifying. I updated the title.&lt;/p&gt;

&lt;p&gt;Still wondering about: &quot;just the simple act of waking the thread has to have side effects&quot;&lt;br/&gt;
This is a mysterious requirement to me.&lt;/p&gt;

&lt;p&gt;In any case maybe the presence or absence of a predicate is an obscure way to specify that behavior. Apologies for what might be silly questions, but I don&apos;t understand this request or the waitForConditionOrUntil function super-well. I&apos;m just trying to understand the ticket.&lt;/p&gt;</comment>
                            <comment id="4779694" author="JIRAUSER1264163" created="Fri, 26 Aug 2022 15:19:40 +0000"  >&lt;p&gt;I&apos;m referring to the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/41d0a45aaf90b8e4e9a91f13a72e5623ecd963c4/src/mongo/util/interruptible.h#L359&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;Interruptible::waitForConditionOrUntil&lt;/tt&gt;&lt;/a&gt; interface. Essentially we have a use-case where we want to be susceptible to interruptions (timeouts, killing the operation, etc.) and have a deadline but we can&apos;t really use the predicate in a meaningful manner because just the simple act of waking the thread has to have side effects.&lt;/p&gt;</comment>
                            <comment id="4779656" author="billy.donahue" created="Fri, 26 Aug 2022 15:10:21 +0000"  >&lt;p&gt;I suspect I don&apos;t understand the request. Can you clarify?&lt;/p&gt;

&lt;p&gt;It feels like what your asking for and what I &lt;b&gt;think&lt;/b&gt; you&apos;re asking for are different things.&lt;/p&gt;

&lt;p&gt;What do you mean by &quot;the current interface for waiting on a condition variable&quot;? You can &lt;tt&gt;cv.wait&lt;/tt&gt; without a predicate if you want to.&lt;/p&gt;

&lt;p&gt;A condition variable wait predicate should not be signalling anything or have side effects, whether it passes or fails. If some code has to run after the condition variable wait() completes (e.g. to signal something), would it work to just place it after the wait statement?&lt;/p&gt;

&lt;p&gt;A predicate doesn&apos;t expose you to spurious wake-ups, it&apos;s a means of suppressing them. So I&apos;m not sure what that means.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="2122882">SERVER-69179</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="2115026">SERVER-68854</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>8.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_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 26 Aug 2022 15:10:21 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        1 year, 22 weeks, 1 day 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>alexander.golin@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            1 year, 22 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>backlog-server-servicearch</customfieldvalue>
            <customfieldvalue>billy.donahue@mongodb.com</customfieldvalue>
            <customfieldvalue>jason.chan@mongodb.com</customfieldvalue>
            <customfieldvalue>jordi.olivares-provencio@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i17vef:</customfieldvalue>

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

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