<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:09: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>[CDRIVER-386] Support recovery from Out of Memory condition</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-386</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description></description>
                <environment></environment>
        <key id="144405">CDRIVER-386</key>
            <summary>Support recovery from Out of Memory condition</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="backlog-c-driver">Backlog - C Driver Team</assignee>
                                    <reporter username="alex.lerner">Alex Lerner</reporter>
                        <labels>
                    </labels>
                <created>Fri, 27 Jun 2014 22:30:45 +0000</created>
                <updated>Wed, 3 Jan 2018 17:01:02 +0000</updated>
                            <resolved>Mon, 24 Apr 2017 23:22:41 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>8</watches>
                                                                                                                <comments>
                            <comment id="1517964" author="jesse" created="Tue, 7 Mar 2017 16:58:31 +0000"  >&lt;p&gt;This improvement will not, realistically, ever reach a priority level that will justify the effort. We&apos;ll reopen this ticket if we see convincing evidence otherwise.&lt;/p&gt;</comment>
                            <comment id="662183" author="christian.hergert@10gen.com" created="Thu, 17 Jul 2014 18:04:06 +0000"  >&lt;p&gt;Can you throw a minimal example patch together so I can see what that would look like? It sounds reasonable to me, but I don&apos;t exactly know what I&apos;m saying yes to!&lt;/p&gt;</comment>
                            <comment id="661530" author="itay" created="Thu, 17 Jul 2014 06:03:09 +0000"  >&lt;p&gt;Thanks for the update. I saw the vtable additions for memory, and they are useful, though they don&apos;t give a full fix to the problem.&lt;/p&gt;

&lt;p&gt;One thing I was wondering: how difficult would it be to have an option to compile the driver in C++ mode? This may allow a custom function (via the vtable implementation) that would throw an std::bad_alloc exception, thus allowing us to at least exit the stack. Is this totally nuts?&lt;/p&gt;</comment>
                            <comment id="660992" author="christian.hergert@10gen.com" created="Wed, 16 Jul 2014 19:25:40 +0000"  >&lt;p&gt;Hi Itay,&lt;/p&gt;

&lt;p&gt;I think the ability to recover from OOM in a 100% way is out of scope for what we want in the C driver. It will add significant complexity to the code base for something that is quite special purpose (and again, libdbus is the only library I&apos;ve seen successfully handle OOM to this day on Linux). If you read the source to that library, you&apos;ll see why I&apos;m concerned.&lt;/p&gt;

&lt;p&gt;However, we do have a new VTable for memory operations in Libbson. This means that you can keep a separate heap around for the OOM situations if you like and manage that. If you still want to take it another step further, you can perform driver work in a setjmp/longjmp context and jump back in the failure to malloc from a custom malloc handler. This would allow you to recover at some point in the future when there is more memory available.&lt;/p&gt;

&lt;p&gt;Probably not the answer you are looking for, but I think this will handle a good amount more than you&apos;d expect.&lt;/p&gt;</comment>
                            <comment id="645554" author="itay" created="Wed, 2 Jul 2014 07:15:52 +0000"  >&lt;p&gt;Christian - thanks for responding.&lt;/p&gt;

&lt;p&gt;You obviously maintain the library, so it&apos;s up to you, but I&apos;d like to provide my (uninvited) two cents.&lt;/p&gt;

&lt;p&gt;While the suggestion above (to have a memory pressure relieving &quot;valve&quot;) is good and would be a welcome addition, I don&apos;t think it&apos;s sufficient.&lt;/p&gt;

&lt;p&gt;It&apos;s very hard to use and link against a library that will cause your program to abort without recourse in this condition. It takes the control from the application and puts it into the library. While I agree that it is likely that a full &quot;scrubbing&quot; and a check of every malloc (and the tree of usages of it) will likely miss some cases, I don&apos;t think that puts us in a worse position or makes &quot;all the work lost&quot;.&lt;/p&gt;

&lt;p&gt;The reason for this is that if the work is done but we miss some things, those things are bugs that can be fixed. As it stands today, there is no way for us to fix the issue at all - we&apos;re at the mercy of the library.&lt;/p&gt;

&lt;p&gt;I think you can still maintain your current &quot;abort&quot; semantics for those that want it by simply having it as a compile time switch. However, it would be very nice to see us have a safe malloc option and check it (and its tree of usages) as well. I realize this is a big undertaking, but better now than later, and better now than never.&lt;/p&gt;

&lt;p&gt;Hope this makes sense - happy to explain more.&lt;/p&gt;</comment>
                            <comment id="641197" author="christian.hergert@10gen.com" created="Tue, 1 Jul 2014 22:18:06 +0000"  >&lt;p&gt;This is going to need some planning.&lt;/p&gt;

&lt;p&gt;What worries me is littering the codebase with things like checking if formatting a new allocated string worked. I really don&apos;t trust code that does that, because one slip and all your work is lost.&lt;/p&gt;

&lt;p&gt;What seems more tenable, is adding a callback upon memory pressure that allows the host application to release malloc memory so the library can continue to make progress. This could be plumbed into the malloc wrappers fairly easily.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="136499">CDRIVER-366</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="208491">CDRIVER-697</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                    <customfield id="customfield_13552" key="com.go2group.jira.plugin.crm:crm_generic_field">
                        <customfieldname>Case</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[[500A000000UaYpdIAF]]]></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_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hst0rj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>158466</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="205">Sprint 5 - July 7-25</customfieldvalue>
    <customfieldvalue id="374">Platform 00 2/20/15</customfieldvalue>

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