<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:04:59 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-4107] Server exits after JS Error: out of memory nofile_b:7</title>
                <link>https://jira.mongodb.org/browse/SERVER-4107</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Our production server, which is under moderate load occasionally shows the javascript error shown in the attached gist and exits (of course, bringing our entire site down, paging, etc.).&lt;/p&gt;

&lt;p&gt;   &lt;a href=&quot;https://gist.github.com/5180b96319f3c4453d58&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://gist.github.com/5180b96319f3c4453d58&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We don&apos;t have any custom javascript running, nor are the queries typically very complex.&lt;/p&gt;
</description>
                <environment>ubuntu 10.4</environment>
        <key id="23874">SERVER-4107</key>
            <summary>Server exits after JS Error: out of memory nofile_b:7</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="3">Duplicate</resolution>
                                        <assignee username="antoine">Antoine Girbal</assignee>
                                    <reporter username="stevefram">Steve Fram</reporter>
                        <labels>
                    </labels>
                <created>Thu, 20 Oct 2011 22:05:02 +0000</created>
                <updated>Wed, 29 Feb 2012 03:54:00 +0000</updated>
                            <resolved>Fri, 2 Dec 2011 07:14:58 +0000</resolved>
                                    <version>1.8.1</version>
                                                    <component>JavaScript</component>
                                        <votes>1</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="73681" author="scotthernandez" created="Fri, 16 Dec 2011 03:09:40 +0000"  >&lt;p&gt;Since the javascript engine is compiled in if there is a memory issue&lt;br/&gt;
then it causes the shutdown. There isn&apos;t much we can do about that. If&lt;br/&gt;
there is invalid memory access from the JavaScript engine it could&lt;br/&gt;
cause errors anywhere in the running program so once it happens&lt;br/&gt;
nothing is safe anymore.&lt;/p&gt;


</comment>
                            <comment id="70363" author="antoine" created="Fri, 2 Dec 2011 07:14:58 +0000"  >&lt;p&gt;This issue will be resolved by implementing other issues depended on. Note that the likely culprit is &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-3538&quot; title=&quot;UTF8 null character \u0000 in the middle of a string is not handled correctly&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-3538&quot;&gt;&lt;del&gt;SERVER-3538&lt;/del&gt;&lt;/a&gt; which is fixed in upcoming 2.0.2&lt;/p&gt;</comment>
                            <comment id="62078" author="eliot" created="Sun, 23 Oct 2011 21:58:16 +0000"  >&lt;p&gt;Making the memory limit tunable might be an option, but it would just buy more time, not fix the underlying issue.&lt;br/&gt;
Process isolation is also an option, but would reduce the performance somewhat significantly in many cases.&lt;/p&gt;

&lt;p&gt;We&apos;re actually talking to the v8 team about possible options.&lt;/p&gt;</comment>
                            <comment id="62075" author="chriseppstein" created="Sun, 23 Oct 2011 20:26:46 +0000"  >&lt;p&gt;@eliot glad to hear you are working on it. If there&apos;s no good solution at this time why isn&apos;t the memory limit tunable? Also it seems like you could manage this via process isolation like they do in chrome.&lt;/p&gt;


</comment>
                            <comment id="61956" author="eliot" created="Sat, 22 Oct 2011 00:02:20 +0000"  >&lt;p&gt;The fixes antoine mentions mitigate a large number of issues - but the js engines still get very unstable once they run out of memory.&lt;br/&gt;
We&apos;re testing v8 to see if its better than spidermonkey in this regard, but hasn&apos;t been very promising.&lt;/p&gt;</comment>
                            <comment id="61955" author="eliot" created="Fri, 21 Oct 2011 23:59:17 +0000"  >&lt;p&gt;@chris - To clarify, the error condition is not acceptable, and we are working on solutions.  We are issues in the js implementations we use, so its hard to have a specific ETA on a fix.&lt;/p&gt;</comment>
                            <comment id="61928" author="chriseppstein" created="Fri, 21 Oct 2011 21:55:45 +0000"  >&lt;p&gt;We only use these queries as part of nightly jobs that update our documents &amp;#8211; they are not done as part of the request/response lifecycle. So these are not our most common queries &amp;#8211; they exist to optimize our most common queries.&lt;/p&gt;

&lt;p&gt;Are you saying that if I used inline javascript instead of an uploaded javascript, this failure condition wouldn&apos;t exist?&lt;/p&gt;

&lt;p&gt;We will upgrade, but when I see your CTO say that this fundamental instability as a result normal operations is reasonable it really worries me. I hope that you will retract or clarify your statement that crashing during a query is ever a reasonable behavior for critical infrastructure. We are using MongoDB in this part of our product as a test with an eye towards rolling it out to more of our product and I&apos;ve been telling other people who trust me that they should use it. I am now re-thinking my position.&lt;/p&gt;</comment>
                            <comment id="61845" author="antoine" created="Fri, 21 Oct 2011 18:08:02 +0000"  >&lt;p&gt;a few things that are related to this ticket:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;as much as possible, it is better to avoid javascript execution for very frequent querying.&lt;br/&gt;
MongoDB is a C++ db and only gives 8MB of ram for JS to execute in 1.8.1.&lt;br/&gt;
Basically if a query can be expressed in both JS and query language, avoid JS.&lt;br/&gt;
Note that the JS heap was increased to 64MB in 1.8.3 and 2.0.&lt;/li&gt;
&lt;/ul&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-3528&quot; title=&quot;memory footprint of JS context keeps increasing as it is used&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-3528&quot;&gt;&lt;del&gt;SERVER-3528&lt;/del&gt;&lt;/a&gt;: we discovered that the js scope in spidermonkey keeps increasing over time.&lt;br/&gt;
We now make sure they get recycled.&lt;/li&gt;
&lt;/ul&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-3012&quot; title=&quot;JS &amp;quot;out of memory&amp;quot; should recover more gracefully&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-3012&quot;&gt;&lt;del&gt;SERVER-3012&lt;/del&gt;&lt;/a&gt;: with this ticket we make sure we clear the scope cache in case of an out of memory.&lt;br/&gt;
This way if a single query goes to use over the memory limit, it will not affect the js engine further.&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="61824" author="chriseppstein" created="Fri, 21 Oct 2011 16:44:28 +0000"  >&lt;p&gt;It is invoked like this:&lt;/p&gt;


&lt;p&gt;$where: &quot;resourceNotInRegion(this, &apos;ZipCode&apos;, &apos;region-name&apos;, &apos;123456&apos;)&quot;&lt;/p&gt;</comment>
                            <comment id="61821" author="eliot" created="Fri, 21 Oct 2011 16:21:46 +0000"  >&lt;p&gt;There should be more than that.&lt;br/&gt;
A $where function has &quot;this&quot; set to the current doc&lt;/p&gt;</comment>
                            <comment id="61819" author="chriseppstein" created="Fri, 21 Oct 2011 16:14:54 +0000"  >&lt;p&gt;it&apos;s used in a $where clause in some queries.&lt;/p&gt;</comment>
                            <comment id="61818" author="eliot" created="Fri, 21 Oct 2011 16:11:24 +0000"  >&lt;p&gt;How are you invoking that, etc.?&lt;br/&gt;
Doesn&apos;t seem it can be used directly.&lt;/p&gt;</comment>
                            <comment id="61816" author="chriseppstein" created="Fri, 21 Oct 2011 16:00:29 +0000"  >&lt;p&gt;I have updated the gist to include the js file that is running in our system&lt;/p&gt;</comment>
                            <comment id="61811" author="eliot" created="Fri, 21 Oct 2011 15:42:31 +0000"  >&lt;p&gt;Can you sen all the ja code you use?  So $where db.eval and map/reduce?  Nothing else usies js&lt;/p&gt;</comment>
                            <comment id="61807" author="chriseppstein" created="Fri, 21 Oct 2011 15:26:12 +0000"  >&lt;p&gt;Who is @paul?&lt;/p&gt;

&lt;p&gt;WTF guys. this is a javascript based database and you&apos;re telling me that it&apos;s unstable even at 2.0? I&apos;m crying. Please tell me what we can do to avoid this.&lt;/p&gt;</comment>
                            <comment id="61806" author="eliot" created="Fri, 21 Oct 2011 15:21:16 +0000"  >&lt;p&gt;@chris - we are trying to make the js engines more robust ( &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-3012&quot; title=&quot;JS &amp;quot;out of memory&amp;quot; should recover more gracefully&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-3012&quot;&gt;&lt;del&gt;SERVER-3012&lt;/del&gt;&lt;/a&gt; ) but at current they can get very unstable after out of memory errors&lt;/p&gt;</comment>
                            <comment id="61805" author="eliot" created="Fri, 21 Oct 2011 15:19:49 +0000"  >&lt;p&gt;@paul - can you also send the $where code and any other js code you use?&lt;/p&gt;</comment>
                            <comment id="61804" author="eliot" created="Fri, 21 Oct 2011 15:18:33 +0000"  >&lt;p&gt;This isn&apos;t a single query failure.&lt;br/&gt;
The query (because of a bug or something like that) creates an invalid internal state which is not recoverable from.&lt;br/&gt;
All subsequent js queries would fail.&lt;/p&gt;</comment>
                            <comment id="61802" author="chriseppstein" created="Fri, 21 Oct 2011 15:16:36 +0000"  >&lt;p&gt;No. Shutting down is not at all reasonable. This query should error out but the database should keep working. We are simply using basic, documented features of mongodb and those should never be able to crash the whole db. Does PLSQL crash mysql? No. Frankly, I&apos;m astonished by your answer.&lt;/p&gt;</comment>
                            <comment id="61756" author="eliot" created="Fri, 21 Oct 2011 05:07:31 +0000"  >&lt;p&gt;This error indicates a catastrophic js engine failure, so shutting down is reasonable.&lt;/p&gt;</comment>
                            <comment id="61720" author="stevefram" created="Fri, 21 Oct 2011 00:43:42 +0000"  >&lt;p&gt;Thank you.  will try some upgrades.&lt;/p&gt;

&lt;p&gt;Question &amp;#8211; do you think it is the appropriate behavior for the entire server to shut down in cases where a single query fails ?  I certainly would rather that this memory management problem trigger an error state, rather than causing a catastrophic failure.&lt;/p&gt;
</comment>
                            <comment id="61704" author="scotthernandez" created="Thu, 20 Oct 2011 22:16:26 +0000"  >&lt;p&gt;It looks like you are using $where (javascript) in your queries. The javascript heap size has been increased in 2.0.x and should help reduce these kinds of issues (memory allocation for js).&lt;/p&gt;

&lt;p&gt;Please think about upgrading to 2.0.1 when it comes out in the next few days.&lt;/p&gt;

&lt;p&gt;We would also suggest upgrading to 1.8.3/4 as there have been many bug fixes from since 1.8.1.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="16434">SERVER-3012</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="23942">SERVER-4124</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="25877">SERVER-4414</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>22.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 20 Oct 2011 22:16:26 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        12 years, 9 weeks, 5 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[<s><a href='https://jira.mongodb.org/browse/SERVER-3012'>SERVER-3012</a></s>, <s><a href='https://jira.mongodb.org/browse/SERVER-4124'>SERVER-4124</a></s>, <s><a href='https://jira.mongodb.org/browse/SERVER-4414'>SERVER-4414</a></s>]]></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>ian@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            12 years, 9 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </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>antoine</customfieldvalue>
            <customfieldvalue>chriseppstein</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
            <customfieldvalue>scotthernandez</customfieldvalue>
            <customfieldvalue>stevefram</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hronpb:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>22979</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_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|hrnv1b:</customfieldvalue>

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