Segmentation fault error with stored functions

132 views
Skip to first unread message

zarincheg

unread,
Dec 15, 2011, 10:19:40 AM12/15/11
to mongodb-user
Hello!
I have a problem with stored functions, that has invalid sintax in
body. If i try add this function in console client, I receive message:
“Sintax error”, ok. But if I try to add function in php-script, like
this:

function addFunc($funcName, $funcBody) {
$collection = $this->db->test->selectCollection('system.js');
return $collection->save(array(
'_id' => $funcName,
'value' => new \MongoCode($funcBody),
), array("safe" => true));
}

I don’t receive any error messages, also if
var_dump(MongoDB::lastError()) called output looks like good, no
errors. And the broken function will be added.

Bad function body:
function url (report) { var list ={}; for(var i=0 ; i <
report.length; i++) { list[] = report[0][scan_doctype]}; return
list; }

Then I try to .find() for list functions or call additional function
segmentation fault happen:

> db.system.js.find()
{ "_id" : "addNumbers", "value" : function cf__2__f_(x, y) {
return x + y;
} }

Thu Dec 15 15:47:06 compile failed for: function url (report) { var
list ={}; for(var i=0 ; i < report.length; i++) { list[] = report[0]
[scan_doctype]}; return list; }
Thu Dec 15 15:47:06 mongo got signal 11 (Segmentation fault), stack
trace:

Thu Dec 15 15:47:06 0x80aa159 0x583400 0x815f4c7 0x814aaf9 0x81b0973
0x81b0d51 0x8197fcd 0x8199d51 0x81a7818 0x81619de 0x8161a7f 0x8163173
0x815e4b3 0x80ae940 0x80b006a 0xb91ce7 0x80a8c41
mongo(_Z12quitAbruptlyi+0x399) [0x80aa159]
[0x583400]
mongo(JS_GetFunctionObject+0x7) [0x815f4c7]
mongo(_ZN5mongo16resolveBSONFieldEP9JSContextP8JSObjectljPS3_+0x229)
[0x814aaf9]
mongo(js_LookupPropertyWithFlags+0x383) [0x81b0973]
mongo(js_LookupProperty+0x41) [0x81b0d51]
mongo(js_CallIteratorNext+0x22d) [0x8197fcd]
mongo(js_Interpret+0x601) [0x8199d51]
mongo(js_Execute+0x2c8) [0x81a7818]
mongo(JS_EvaluateUCScriptForPrincipals+0x9e) [0x81619de]
mongo(JS_EvaluateUCScript+0x4f) [0x8161a7f]
mongo(JS_EvaluateScript+0x73) [0x8163173]
mongo(_ZN5mongo7SMScope4execERKNS_10StringDataERKSsbbbi+0x123)
[0x815e4b3]
mongo(_Z5_mainiPPc+0x2cb0) [0x80ae940]
mongo(main+0x4a) [0x80b006a]
/lib/libc.so.6(__libc_start_main+0xe7) [0xb91ce7]
mongo(__gxx_personality_v0+0x1fd) [0x80a8c41]
System info:
Linux R2D2 2.6.35-31-generic #63-Ubuntu SMP Mon Nov 28 19:23:11 UTC
2011 i686 GNU/Linux

Mongo version 2.0.1 and 2.0.2

phpext:
mongo

MongoDB Support => enabled
Version => 1.2.6

Directive => Local Value => Master Value
mongo.allow_empty_keys => 0 => 0
mongo.allow_persistent => 1 => 1
mongo.auto_reconnect => 1 => 1
mongo.chunk_size => 262144 => 262144
mongo.cmd => $ => $
mongo.default_host => localhost => localhost
mongo.default_port => 27017 => 27017
mongo.long_as_object => 0 => 0
mongo.native_long => 0 => 0
mongo.no_id => 0 => 0
mongo.utf8 => 1 => 1

How I can resolve this? I understand code must be correct, but I want
see any errors if it is not.

Kristina Chodorow

unread,
Dec 16, 2011, 2:20:58 PM12/16/11
to mongodb-user
This is a bug, I've created an issue for it (you can watch):
https://jira.mongodb.org/browse/SERVER-4513

Kirill Zorin

unread,
Dec 23, 2011, 1:15:36 AM12/23/11
to mongodb-user
Thanks, I hope bug will be fixed soon)

On 16 дек, 23:20, Kristina Chodorow <k.chodo...@gmail.com> wrote:
> This is a bug, I've created an issue for it (you can watch):https://jira.mongodb.org/browse/SERVER-4513
>
Reply all
Reply to author
Forward
0 new messages