<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:06:12 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-4512] segmentation fault on map-reduce javascript syntax error</title>
                <link>https://jira.mongodb.org/browse/SERVER-4512</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Putting the following javascript function into the scope of a map reduce call makes the mongod process to seg fault.&lt;/p&gt;

&lt;p&gt;Javascript function in the map reduce scope:&lt;/p&gt;

&lt;p&gt;function(values) {&lt;br/&gt;
  copy_val = {};&lt;br/&gt;
  for (var k in values):   // &amp;lt;-- SYNTAX ERROR&lt;br/&gt;
    copy_val&lt;span class=&quot;error&quot;&gt;&amp;#91;k&amp;#93;&lt;/span&gt; = values&lt;span class=&quot;error&quot;&gt;&amp;#91;k&amp;#93;&lt;/span&gt;;            &lt;br/&gt;
  return copy_val;&lt;br/&gt;
};&lt;/p&gt;

&lt;p&gt;Clearly the function has a syntax error (the colon after the for loop).&lt;/p&gt;

&lt;p&gt;Mongod log is as follows (also in attach).&lt;/p&gt;

&lt;p&gt;Fri Dec 16 17:18:52 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn103&amp;#93;&lt;/span&gt; JS Error: SyntaxError: syntax error nofile_b:2&lt;br/&gt;
Fri Dec 16 17:18:52 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn103&amp;#93;&lt;/span&gt; compile failed for: function(values) {&lt;br/&gt;
                copy_val = {};&lt;br/&gt;
                for (var k in values):&lt;br/&gt;
                    copy_val&lt;span class=&quot;error&quot;&gt;&amp;#91;k&amp;#93;&lt;/span&gt; = values&lt;span class=&quot;error&quot;&gt;&amp;#91;k&amp;#93;&lt;/span&gt;;&lt;/p&gt;

&lt;p&gt;                return copy_val;&lt;br/&gt;
            };&lt;br/&gt;
Fri Dec 16 17:18:52 Invalid access at address: 0&lt;/p&gt;

&lt;p&gt;Fri Dec 16 17:18:52 Got signal: 11 (Segmentation fault).&lt;/p&gt;

&lt;p&gt;Fri Dec 16 17:18:52 Backtrace:&lt;br/&gt;
0xa89b19 0xa8a0f0 0x7f734bca38f0 0x6b9190 0x6b66a0 0x6b8177 0x9a24b3 0x9bbe94 0x9766df 0x9783b5 0x961745 0x964ad1 0x882407 0x888c2c 0xa9c576 0x638937 0x7f734bc9a9ca 0x7f734b24970d &lt;br/&gt;
 /opt/mongodb/current/bin/mongod(_ZN5mongo10abruptQuitEi+0x399) &lt;span class=&quot;error&quot;&gt;&amp;#91;0xa89b19&amp;#93;&lt;/span&gt;&lt;br/&gt;
 /opt/mongodb/current/bin/mongod(_ZN5mongo24abruptQuitWithAddrSignalEiP7siginfoPv+0x220) &lt;span class=&quot;error&quot;&gt;&amp;#91;0xa8a0f0&amp;#93;&lt;/span&gt;&lt;br/&gt;
 /lib/libpthread.so.0(+0xf8f0) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x7f734bca38f0&amp;#93;&lt;/span&gt;&lt;br/&gt;
 /opt/mongodb/current/bin/mongod(JS_GetFunctionObject+0) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x6b9190&amp;#93;&lt;/span&gt;&lt;br/&gt;
 /opt/mongodb/current/bin/mongod(_ZN5mongo9Convertor5tovalERKNS_11BSONElementE+0xa20) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x6b66a0&amp;#93;&lt;/span&gt;&lt;br/&gt;
 /opt/mongodb/current/bin/mongod(_ZN5mongo7SMScope4initEPKNS_7BSONObjE+0xc7) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x6b8177&amp;#93;&lt;/span&gt;&lt;br/&gt;
 /opt/mongodb/current/bin/mongod(_ZN5mongo2mr5State4initEv+0x1f3) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x9a24b3&amp;#93;&lt;/span&gt;&lt;br/&gt;
 /opt/mongodb/current/bin/mongod(_ZN5mongo2mr16MapReduceCommand3runERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb+0x1a4) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x9bbe94&amp;#93;&lt;/span&gt;&lt;br/&gt;
 /opt/mongodb/current/bin/mongod(_ZN5mongo11execCommandEPNS_7CommandERNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb+0x62f) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x9766df&amp;#93;&lt;/span&gt;&lt;br/&gt;
 /opt/mongodb/current/bin/mongod(_ZN5mongo12_runCommandsEPKcRNS_7BSONObjERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi+0x705) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x9783b5&amp;#93;&lt;/span&gt;&lt;br/&gt;
 /opt/mongodb/current/bin/mongod(_ZN5mongo11runCommandsEPKcRNS_7BSONObjERNS_5CurOpERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi+0x35) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x961745&amp;#93;&lt;/span&gt;&lt;br/&gt;
 /opt/mongodb/current/bin/mongod(&lt;em&gt;ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1&lt;/em&gt;+0x11e1) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x964ad1&amp;#93;&lt;/span&gt;&lt;br/&gt;
 /opt/mongodb/current/bin/mongod() &lt;span class=&quot;error&quot;&gt;&amp;#91;0x882407&amp;#93;&lt;/span&gt;&lt;br/&gt;
 /opt/mongodb/current/bin/mongod(_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0x55c) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x888c2c&amp;#93;&lt;/span&gt;&lt;br/&gt;
 /opt/mongodb/current/bin/mongod(_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE+0x76) &lt;span class=&quot;error&quot;&gt;&amp;#91;0xa9c576&amp;#93;&lt;/span&gt;&lt;br/&gt;
 /opt/mongodb/current/bin/mongod(_ZN5mongo3pms9threadRunEPNS_13MessagingPortE+0x287) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x638937&amp;#93;&lt;/span&gt;&lt;br/&gt;
 /lib/libpthread.so.0(+0x69ca) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x7f734bc9a9ca&amp;#93;&lt;/span&gt;&lt;br/&gt;
 /lib/libc.so.6(clone+0x6d) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x7f734b24970d&amp;#93;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Logstream::get called in uninitialized state&lt;br/&gt;
Fri Dec 16 17:18:52 ERROR: Client::shutdown not called: conn&lt;/p&gt;


&lt;p&gt;The same javascript syntax error does not trigger the seg fault if executed in the mongo shell.&lt;/p&gt;

&lt;p&gt;&amp;gt; db.eval(&quot;function testone() { values = {}; copy_val = {}; for (var k in values): copy_val&lt;span class=&quot;error&quot;&gt;&amp;#91;k&amp;#93;&lt;/span&gt; = values&lt;span class=&quot;error&quot;&gt;&amp;#91;k&amp;#93;&lt;/span&gt;; return copy_val; };&quot;)&lt;br/&gt;
Fri Dec 16 17:58:41 uncaught exception: {&lt;br/&gt;
        &quot;errmsg&quot; : &quot;compile failed: JS Error: SyntaxError: syntax error nofile_b:0&quot;,&lt;br/&gt;
        &quot;ok&quot; : 0&lt;br/&gt;
}&lt;/p&gt;</description>
                <environment>Ubuntu 10.04.3 LTS Linux 2.6.32-32-generic #62-Ubuntu SMP x86_64 GNU/Linux&lt;br/&gt;
sysInfo: Linux bs-linux64.10gen.cc 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_41&lt;br/&gt;
versionArray: Array&lt;br/&gt;
bits: 64&lt;br/&gt;
debug&lt;br/&gt;
maxBsonObjectSize: 16777216</environment>
        <key id="26794">SERVER-4512</key>
            <summary>segmentation fault on map-reduce javascript syntax error</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="aappii">Api</reporter>
                        <labels>
                            <label>javascript</label>
                            <label>map_reduce</label>
                            <label>mapreduce,</label>
                    </labels>
                <created>Fri, 16 Dec 2011 17:06:19 +0000</created>
                <updated>Tue, 29 May 2012 14:53:18 +0000</updated>
                            <resolved>Wed, 21 Dec 2011 08:17:53 +0000</resolved>
                                    <version>2.0.1</version>
                                                    <component>JavaScript</component>
                    <component>MapReduce</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="74966" author="antoine" created="Wed, 21 Dec 2011 08:23:24 +0000"  >&lt;p&gt;thanks for the report.&lt;br/&gt;
This will be fixed in 2.1.0 and later.&lt;/p&gt;</comment>
                            <comment id="74747" author="aappii" created="Tue, 20 Dec 2011 16:53:53 +0000"  >&lt;p&gt;The crash is triggered by requesting a Map Reduce via a Python program using the Python driver (PyMongo).&lt;br/&gt;
Instead, requesting the same Map Reduce (with the JS syntax error in the scope) in the mongo shell, no crash is triggered, but the syntax error is reported correctly by mongo (see above).&lt;/p&gt;

&lt;p&gt;I think the two bugs are related (sorry, I didn&apos;t found the duplicate since I searched for critical bugs: a server crash is regarded to be critical).&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;</comment>
                            <comment id="74151" author="antoine" created="Sat, 17 Dec 2011 18:46:50 +0000"  >&lt;p&gt;How exactly do you trigger the crash, using what client / driver?&lt;br/&gt;
You are saying that you cannot trigger the error from shell?&lt;/p&gt;

&lt;p&gt;most likely this is related to &lt;br/&gt;
&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-3425&quot; title=&quot;Server crash when passed invalid JS in CodeWScope object&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-3425&quot;&gt;&lt;del&gt;SERVER-3425&lt;/del&gt;&lt;/a&gt;: Server crash when passed invalid JS in CodeWScope object&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="14163" name="mongodb.crash.log" size="2522" author="aappii" created="Fri, 16 Dec 2011 17:06:19 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Sat, 17 Dec 2011 18:46:50 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        12 years, 9 weeks 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>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 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="10020"><![CDATA[Linux]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>antoine</customfieldvalue>
            <customfieldvalue>aappii</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hriinr:</customfieldvalue>

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

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

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