<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:39:20 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-15902] use signal handling stack via sigaltstack to improve behavior on stack overflow</title>
                <link>https://jira.mongodb.org/browse/SERVER-15902</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;In case of stack overflow mongod may not be able to produce a stack trace in the log because the signal handler has no stack space to run in, significantly hampering diagnosis. Servicability could be improved by using sigaltstack to establish a separate signal-handling stack, allowing stack traces to be produced in case of stack overflow.&lt;/p&gt;</description>
                <environment></environment>
        <key id="166675">SERVER-15902</key>
            <summary>use signal handling stack via sigaltstack to improve behavior on stack overflow</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="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="billy.donahue@mongodb.com">Billy Donahue</assignee>
                                    <reporter username="bruce.lucas@mongodb.com">Bruce Lucas</reporter>
                        <labels>
                            <label>platforms-re-triaged</label>
                            <label>service_architecture_continuous_delivery</label>
                    </labels>
                <created>Fri, 31 Oct 2014 15:44:05 +0000</created>
                <updated>Fri, 9 Oct 2020 20:15:52 +0000</updated>
                            <resolved>Fri, 25 Oct 2019 19:10:55 +0000</resolved>
                                                    <fixVersion>4.3.1</fixVersion>
                    <fixVersion>4.2.6</fixVersion>
                    <fixVersion>4.0.21</fixVersion>
                                    <component>Diagnostics</component>
                    <component>Internal Code</component>
                                        <votes>1</votes>
                                    <watches>13</watches>
                                                                                                                <comments>
                            <comment id="3437528" author="xgen-internal-githook" created="Fri, 9 Oct 2020 19:05:05 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Billy Donahue&apos;, &apos;email&apos;: &apos;billy.donahue@mongodb.com&apos;, &apos;username&apos;: &apos;BillyDonahue&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-15902&quot; title=&quot;use signal handling stack via sigaltstack to improve behavior on stack overflow&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-15902&quot;&gt;&lt;del&gt;SERVER-15902&lt;/del&gt;&lt;/a&gt; sigaltstack for workers and stdx::thread.&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 0d84ec739b3e831de70775a5cae20ac1c26c28b1)&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;simulate std::apply with ref(f)(...)&lt;/li&gt;
	&lt;li&gt;remove libfmt dep&lt;/li&gt;
	&lt;li&gt;downgrade some c+&lt;ins&gt;17 idioms to c&lt;/ins&gt;+14.&lt;/li&gt;
	&lt;li&gt;clang-format to v4.0 style&lt;br/&gt;
Branch: v4.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/98ea7262eecc5e42845d65d087e54decf6523bfe&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/98ea7262eecc5e42845d65d087e54decf6523bfe&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="3030399" author="xgen-internal-githook" created="Tue, 7 Apr 2020 21:47:52 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Billy Donahue&apos;, &apos;email&apos;: &apos;billy.donahue@mongodb.com&apos;, &apos;username&apos;: &apos;BillyDonahue&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-15902&quot; title=&quot;use signal handling stack via sigaltstack to improve behavior on stack overflow&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-15902&quot;&gt;&lt;del&gt;SERVER-15902&lt;/del&gt;&lt;/a&gt; sigaltstack for workers and stdx::thread.&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 0d84ec739b3e831de70775a5cae20ac1c26c28b1)&lt;br/&gt;
Branch: v4.2&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/c0df7ba373a8ef50c9d3a642b9dbaaf3ae2fd7f5&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/c0df7ba373a8ef50c9d3a642b9dbaaf3ae2fd7f5&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2501411" author="xgen-internal-githook" created="Fri, 25 Oct 2019 18:00:01 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;BillyDonahue&apos;, &apos;email&apos;: &apos;billy.donahue@mongodb.com&apos;, &apos;name&apos;: &apos;Billy Donahue&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-15902&quot; title=&quot;use signal handling stack via sigaltstack to improve behavior on stack overflow&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-15902&quot;&gt;&lt;del&gt;SERVER-15902&lt;/del&gt;&lt;/a&gt; sigaltstack for workers and stdx::thread.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/0d84ec739b3e831de70775a5cae20ac1c26c28b1&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/0d84ec739b3e831de70775a5cae20ac1c26c28b1&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2498017" author="bruce.lucas@10gen.com" created="Wed, 23 Oct 2019 18:45:55 +0000"  >&lt;p&gt;Thanks for pointing that out. Agree that it still seems like a net win - it seems unlikely that a process that close to the memory limit would remain in that state for long before crashing anyway. And it&apos;s not clear that the alternative (gdb) would function that well in such a circumstance either.&lt;/p&gt;</comment>
                            <comment id="2498002" author="acm" created="Wed, 23 Oct 2019 18:41:13 +0000"  >&lt;p&gt;Thanks &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=bruce.lucas&quot; class=&quot;user-hover&quot; rel=&quot;bruce.lucas&quot;&gt;bruce.lucas&lt;/a&gt;. One other interaction of note. I expect that Billy will soon start working on &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-33445&quot; title=&quot;Add signal handler to generate stack traces&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-33445&quot;&gt;&lt;del&gt;SERVER-33445&lt;/del&gt;&lt;/a&gt;, which will make it possible to send a signal and have all threads dump their stacks. Under this scenario, when using &lt;tt&gt;sigaltstack&lt;/tt&gt; this would cause some of the altstack memory to be actually allocated on every thread. For a server that was near its memory limits, that could be fatal, as it would force those pages to be backed by real memory, at least briefly. Given that the current alternative is to connect with GDB, I think that is still a net win, but I wanted to point it out. &lt;/p&gt;</comment>
                            <comment id="2497980" author="bruce.lucas@10gen.com" created="Wed, 23 Oct 2019 18:31:12 +0000"  >&lt;p&gt;Thanks for the heads-up. I don&apos;t see any problem with the Cons, and the Pros look good to me.&lt;/p&gt;</comment>
                            <comment id="2497968" author="billy.donahue" created="Wed, 23 Oct 2019 18:20:25 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=bruce.lucas&quot; class=&quot;user-hover&quot; rel=&quot;bruce.lucas&quot;&gt;bruce.lucas&lt;/a&gt;, we&apos;ve implemented sigaltstack where available, for stdx::thread and for serviceWorkerThread. We wanted to run it by you for review (&lt;a href=&quot;https://mongodbcr.appspot.com/505290001&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://mongodbcr.appspot.com/505290001&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;It&apos;s been empirically determined that 16kiB should be enough for our stack trace printer, and we add a 4X safety margin for 64kiB. This adds 6.25% to the virtual memory to the 1MiB main stack allocated for each service worker thread. Due to Linux CoW demand paging, however, this memory won&apos;t really be consumed unless the thread uses it by catching a signal, so this added memory is not so bad.&lt;/p&gt;

&lt;p&gt;All synchronous signal handlers are going to use these alternative signal stacks now. This will help diagnostic reporting of threads that are running close to the edge of their stack allocations, and of course with the SIGSEGV caused by stack overflows (including deep/ recursion).&lt;/p&gt;

&lt;p&gt;Some tradeoffs, as far as I can tell:&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Pros:&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&#160; &#160; - We will be able to begin diagnosing stack overruns, but also diagnose other synchronous signals more reliably if they&apos;re running near top of stack or on a corrupted stack.&lt;/p&gt;

&lt;p&gt;&#160; &#160; - This was a low-impact change to the thread creation and signal handler installation routines.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Cons:&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&#160; &#160; - Signal handlers will be constrained to 64kiB of stack, rather than the large 1MiB main thread stack. We will install a test to give some confidence that handlers stay under this limit going forward. We might even be able to reduce the 64kiB to 32kiB after some smoke testing.&lt;/p&gt;

&lt;p&gt;&#160; &#160; - Per-thread virtual memory cost increases by 6.25% (64kiB/1MiB), but this overhead is not paged in until a synchronous signal comes to that thread.&lt;/p&gt;

&lt;p&gt;&#160; &#160; - sigaltstack doesn&apos;t exist on Windows.&lt;/p&gt;

&lt;p&gt;&#160; &#160; - unwinding stack from a signal handler is potentially more complex when the signal is on a sigaltstack. For example, `backtrace()` on MacOS cannot unwind from a sigaltstack, so we cannot use sigaltstack there.&lt;/p&gt;</comment>
                            <comment id="2479214" author="billy.donahue" created="Sun, 13 Oct 2019 03:12:44 +0000"  >&lt;p&gt;&lt;span class=&quot;nobr&quot;&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/attachment/233569/233569_stacktrace-writeup.txt&quot; title=&quot;stacktrace-writeup.txt attached to SERVER-15902&quot;&gt;stacktrace-writeup.txt&lt;sup&gt;&lt;img class=&quot;rendericon&quot; src=&quot;https://jira.mongodb.org/images/icons/link_attachment_7.gif&quot; height=&quot;7&quot; width=&quot;7&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;</comment>
                            <comment id="2342545" author="acm" created="Wed, 24 Jul 2019 22:44:49 +0000"  >&lt;p&gt;Moving this to Q3 quick wins. It doesn&apos;t really have anything directly to do with libunwind, and is probably best handled by way of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-30738&quot; title=&quot;Implement stdx::thread with control over stack sizes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-30738&quot;&gt;&lt;del&gt;SERVER-30738&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="756618" author="schwerin" created="Wed, 5 Nov 2014 15:21:14 +0000"  >&lt;p&gt;This is a modest amount of work, because thread creation occurs in several places in the code base.  Catching the most likely offenders (threads handling user connections) would be less work, certainly.  &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=bruce.lucas%4010gen.com&quot; class=&quot;user-hover&quot; rel=&quot;bruce.lucas@10gen.com&quot;&gt;bruce.lucas@10gen.com&lt;/a&gt;, I&apos;m having trouble bucketing it for planning, so I&apos;m going to leave it in Needs Triage for the time being.&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>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="417978">SERVER-30738</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="233569" name="stacktrace-writeup.txt" size="8927" author="billy.donahue@mongodb.com" created="Sun, 13 Oct 2019 03:12:42 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>10.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>6.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16775"><![CDATA[v4.2]]></customfieldvalue>
    <customfieldvalue key="15640"><![CDATA[v4.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, 5 Nov 2014 15:21:14 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        3 years, 17 weeks, 5 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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-1447</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>dbeng-pm-bot</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            3 years, 17 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>andrew.morrow@mongodb.com</customfieldvalue>
            <customfieldvalue>schwerin@mongodb.com</customfieldvalue>
            <customfieldvalue>billy.donahue@mongodb.com</customfieldvalue>
            <customfieldvalue>bruce.lucas@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrlkbj:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>145622</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="3113">Dev Tools 2019-08-26</customfieldvalue>
    <customfieldvalue id="3246">Dev Tools 2019-09-09</customfieldvalue>
    <customfieldvalue id="3280">Dev Tools 2019-09-23</customfieldvalue>
    <customfieldvalue id="3281">Dev Tools 2019-10-07</customfieldvalue>
    <customfieldvalue id="3282">Dev Tools 2019-10-21</customfieldvalue>
    <customfieldvalue id="3342">Dev Tools 2019-11-04</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|hsbycf:</customfieldvalue>

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