<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:15:24 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-70148] Document proper noexcept usage</title>
                <link>https://jira.mongodb.org/browse/SERVER-70148</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;I think&#160;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-50434&quot; title=&quot;exceptions violating noexcept can be invisible to terminate handler&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-50434&quot;&gt;SERVER-50434&lt;/a&gt; is a big deal.&#160; &lt;a href=&quot;https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97720&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;This&lt;/a&gt; gcc bug means that when we violate a noexcept specification, we have very few tools for figuring out where it came from.&#160; This happened in BF-26507 (an ongoing investigation) and in BF-17935.&#160; We get no log messages saying what exception was thrown.&#160; And in the case of BF-26507 (and possibly BF-17935), inlining makes the backtrace unhelpful.&lt;/p&gt;

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

&lt;p&gt;In most of the cases where we use noexcept for &quot;exception handling,&quot; we would be better off catching the exception, logging a message, and calling std::terminate.&lt;/p&gt;

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

&lt;p&gt;I&apos;m not sure how actionable this ticket is (feel free to close it as a duplicate of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-50434&quot; title=&quot;exceptions violating noexcept can be invisible to terminate handler&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-50434&quot;&gt;SERVER-50434&lt;/a&gt;), but I just want to bring people&apos;s attention to it.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="2149341">SERVER-70148</key>
            <summary>Document proper noexcept usage</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="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="andrew.witten@mongodb.com">Andrew Witten</reporter>
                        <labels>
                    </labels>
                <created>Fri, 30 Sep 2022 20:13:35 +0000</created>
                <updated>Mon, 29 Jan 2024 15:49:22 +0000</updated>
                                                                                                <votes>0</votes>
                                    <watches>12</watches>
                                                                                                                <comments>
                            <comment id="5496728" author="jason.chan" created="Tue, 13 Jun 2023 20:34:44 +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;&apos;s suggestion that a minimal effort improvement would be to document about noexcept and its recommended usage patterns in the architecture guide.&lt;/p&gt;</comment>
                            <comment id="4886965" author="billy.donahue" created="Fri, 7 Oct 2022 19:16:07 +0000"  >&lt;p&gt;We&apos;d never ban it.&lt;br/&gt;
We&apos;d have to consider it with some nuance.&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;noexcept&lt;/tt&gt; is still vitally necessary for move operations, swaps, and things that really and truly won&apos;t actually throw.&lt;br/&gt;
It serves as a queryable hint for callers to choose more efficient exception-safe algorithms.&lt;/p&gt;

&lt;p&gt;We just can&apos;t rely on the compiler to do the right thing when it&apos;s violated, is the thing.&lt;/p&gt;

&lt;p&gt;Noexcept does a few things, not all of which are broken.&lt;/p&gt;

&lt;p&gt;(1) It publishes a compiler-visible interface to a caller guaranteeing that the caller doesn&apos;t have to handle exceptions as a return path of a call. This allows algorithm selection and very theoretically some codegen optimization (particularly if the callee is not inline).&lt;/p&gt;

&lt;p&gt;(2) It sets up an implicit std::terminate try block around the body of the function with possible implementation-defined unwind elision.&lt;/p&gt;

&lt;p&gt;(3) A form of documentation.&lt;/p&gt;

&lt;p&gt;We would be using it SOLELY as a way of augmenting a function&apos;s signature, as in (1).&lt;br/&gt;
Feature (2) is hosed. If you want to make a nontrivial function noexcept for some reason, you could write your own &lt;tt&gt;try{ stuff }catch(...){std::terminate());&lt;/tt&gt;} block around it and not rely on (2).&lt;/p&gt;

&lt;p&gt;It&apos;s much simpler to just not use &lt;tt&gt;noexcept&lt;/tt&gt; at all for functions besides 1-ish liners.&lt;/p&gt;

&lt;p&gt;As for (3), I don&apos;t know how hot a take this is, but I don&apos;t think it&apos;s a good idea to use this keyword in lieu of docs. It doesn&apos;t allow future refinement of the API and noexcept is a forever kind of API decision that&apos;s unnecessary. It&apos;s also misused in our codebase to say that a function doesn&apos;t happen to throw, which is more a synopsis of implementation detail than a statement of contract. I think it can be harmful to readers because they don&apos;t know which meaning of noexcept is implied when they see it in code or are investigating BFs related to noexcept violations.&lt;/p&gt;</comment>
                            <comment id="4880252" author="billy.donahue" created="Wed, 5 Oct 2022 17:05:08 +0000"  >&lt;p&gt;The underlying GCC bug is &quot;UNCONFIRMED&quot; upstream &lt;a href=&quot;https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97720&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97720&lt;/a&gt;&lt;br/&gt;
I haven&apos;t seen it in a v4 toolchain build directly because most of our builds aren&apos;t v4 toolchain, but GCC hasn&apos;t acted on it.&lt;br/&gt;
It&apos;s possible (saying this without searching for evidence to the contrary) the v4 toolchain GCC&apos;s optimizer doesn&apos;t have or at least doesn&apos;t manifest this bug anymore for whatever reason, but we haven&apos;t had a great repro for it.&lt;/p&gt;

&lt;p&gt;Even the original GCC bugzilla bug report was sure to point out how dependent this behavior is on the exact arrangement of source code and compiler versions. In practice, we see that most of our terminate handler invocations do indeed get a current_exception, but it looks like it&apos;s possible for the wind to change direction and have that not be the case anymore for some failure paths.&lt;/p&gt;</comment>
                            <comment id="4880176" author="henrik.edin" created="Wed, 5 Oct 2022 16:38:19 +0000"  >&lt;p&gt;Do we still have this GCC bug in the v4 toolchain?&lt;/p&gt;</comment>
                            <comment id="4873093" author="billy.donahue" created="Mon, 3 Oct 2022 15:19:39 +0000"  >&lt;p&gt;&lt;tt&gt;-Wexceptions&lt;/tt&gt;, being a static check, will &lt;a href=&quot;https://gcc.godbolt.org/z/Edr8aT8ob&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;only catch&lt;/a&gt; trivial cases where a throw occurs directly inside a &lt;tt&gt;noexcept&lt;/tt&gt; function. It&apos;s not a substitute for the action proposed by this ticket.&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;noexcept&lt;/tt&gt; is good and necessary for move operations, without a doubt. As for performance, yes that&apos;s a consideration, but I&apos;d say only for the most trivial and hottest of functions, like a trivial getter or other operators. Inlining these functions produces the same benefit.&lt;/p&gt;

&lt;p&gt;This ticket is meant primarily to work around a GCC bug that makes noexcept violations impossible to track down, in cases where a simple uncaught exception would be traceable. &lt;/p&gt;

&lt;p&gt;A &lt;tt&gt;noexcept&lt;/tt&gt; mark is not a form of documentation. This trend has thankfully been halted, I believe.&lt;/p&gt;

&lt;p&gt;We have made a lot of progress toward backing out of unnecessary noexcepts over the last few years and should not be changing course without a serious proposal to do so.&lt;/p&gt;

&lt;p&gt;Lakos et al &quot;Embracing Modern C++ Safely&quot;, after a lengthy chapter on &lt;tt&gt;noexcept&lt;/tt&gt;, categorizes it as an &quot;unsafe&quot; feature, a category for features that have conditional utility, for sure, but a significant potential for causing harm on a large codebase through copycat overuse. A lot of thought has gone into this topic.&lt;br/&gt;
&lt;a href=&quot;https://www.cppstories.com/2022/embracing-modern-cpp-book/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://www.cppstories.com/2022/embracing-modern-cpp-book/&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4872808" author="JIRAUSER1268551" created="Mon, 3 Oct 2022 14:26:03 +0000"  >&lt;p&gt;I think the better solution would to add a compiler warning when throwing in a noexcept: &lt;a href=&quot;https://clang.llvm.org/docs/DiagnosticsReference.html#wexceptions&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://clang.llvm.org/docs/DiagnosticsReference.html#wexceptions&lt;/a&gt; . There are good and legitimate cases for using noexcept for performance and clarity reasons.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1448201">SERVER-50434</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>6.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>13.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>Mon, 3 Oct 2022 14:26:03 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        34 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>blake.oler@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            34 weeks, 1 day 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>alex.neben@mongodb.com</customfieldvalue>
            <customfieldvalue>andrew.witten@mongodb.com</customfieldvalue>
            <customfieldvalue>backlog-server-servicearch</customfieldvalue>
            <customfieldvalue>billy.donahue@mongodb.com</customfieldvalue>
            <customfieldvalue>henrik.edin@mongodb.com</customfieldvalue>
            <customfieldvalue>jason.chan@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i1cekf:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr1lyw:9</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="6357">Service Arch Prioritized List</customfieldvalue>
    <customfieldvalue id="7613">Service Arch 2023-08-21</customfieldvalue>
    <customfieldvalue id="7614">Service Arch 2023-09-04</customfieldvalue>
    <customfieldvalue id="7615">Service Arch 2023-09-18</customfieldvalue>
    <customfieldvalue id="7616">Service Arch 2023-10-02</customfieldvalue>
    <customfieldvalue id="7617">Service Arch 2023-10-16</customfieldvalue>
    <customfieldvalue id="7618">Service Arch 2023-10-30</customfieldvalue>
    <customfieldvalue id="7619">Service Arch 2023-11-13</customfieldvalue>
    <customfieldvalue id="7935">Service Arch 2023-11-27</customfieldvalue>
    <customfieldvalue id="7936">Service Arch 2023-12-11</customfieldvalue>
    <customfieldvalue id="7937">Service Arch 2023-12-25</customfieldvalue>
    <customfieldvalue id="8038">Service Arch 2024-01-08</customfieldvalue>
    <customfieldvalue id="8039">Service Arch 2024-01-22</customfieldvalue>

                        </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|i1c0pr:</customfieldvalue>

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