[SERVER-636] MapReduce in PHP crashes server Created: 15/Feb/10  Updated: 06/Apr/10  Resolved: 06/Apr/10

Status: Closed
Project: Core Server
Component/s: JavaScript
Affects Version/s: 1.3.2
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Vladimir Vlach Assignee: Eliot Horowitz (Inactive)
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

db version: 1.3.2- PHP 5.2.9 - mongodb-linux-x86_64-v8-2010-02-14; Linux linux-bkk.geoadmin.com 2.6.27.5-117.fc10.x86_64


Participants:

 Description   

Following PHP script will crash mongod

$connection = new Mongo(); // connects to localhost:27017
$game = $connection->test->game;
$start = new MongoDate(strtotime("2009-12-01 00:00:00"));
$end = new MongoDate(strtotime("2010-01-01 00:00:00"));
$game_id = 'wxxz0xu4hdcm7ob4ps47rf89';

$map = new MongoCode("function() { emit(this.g_id,

{c: 2, d: this}

); }");
$reduce = new MongoCode('function(k, vals) {
var sum = 0;
for (var i in vals)

{ sum += 1; }

return sum;
}
');

$where = array("dt" => array('$gt' => $start, '$lte' => $end));

$sales = $connection->casino->command(array(
"mapreduce" => "game",
"map" => $map,
"reduce" => $reduce,
"query" => $where
));

$cursor = $connection->casino->selectCollection($sales['result'])>find()>limit(-100);
foreach ($cursor as $obj){
print_r($obj);
}



 Comments   
Comment by Eliot Horowitz (Inactive) [ 06/Apr/10 ]

if you have a way to reproduce, comment and we can re-open

Comment by Eliot Horowitz (Inactive) [ 15/Mar/10 ]

waiting for help reproducing

Comment by Eliot Horowitz (Inactive) [ 14/Mar/10 ]

Cant' manage to reproduce - can you send log file?

Comment by Vladimir Vlach [ 15/Feb/10 ]

I figured out how to replicate this.

This line works correctly:
$map = new MongoCode("function() { emit(this.g_id,

{c: 2}

); }");

but this one crashes server (see , d: this):
$map = new MongoCode("function() { emit(this.g_id,

{c: 2, d: this}

); }");

Comment by Eliot Horowitz (Inactive) [ 15/Feb/10 ]

Can you send the mongod log file and a sample object

Generated at Thu Feb 08 02:54:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.