Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9117

Mongo segfault on mapreduce - repeatable every time

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.1
    • Component/s: MapReduce
    • Labels:
      None
    • Environment:
      osx
    • ALL
    • Hide

      1 map=function(){
      2 var dealer_identifier = this.source+"_"+this.source_dealer_id
      3 emit(dealer_identifier, {cars: [

      {source: this.source, source_id: this.source_id}

      ] });
      4 }
      5
      6 reduce=function(key,values){
      7 reducedValue =

      {cars: [] }

      ;
      8 values.forEach(function(value){
      9 for(x in value.cars)

      { 10 reducedValue.cars.push(value.cars[x]); 11 }

      12 });
      13 return reducedValue;
      14 }
      15
      16 db.getCollection("atc_and_cdc_reduced").mapReduce(map, reduce,

      {out: "import_data_dealer_cars"}

      );

      Show
      1 map=function(){ 2 var dealer_identifier = this.source+"_"+this.source_dealer_id 3 emit(dealer_identifier, {cars: [ {source: this.source, source_id: this.source_id} ] }); 4 } 5 6 reduce=function(key,values){ 7 reducedValue = {cars: [] } ; 8 values.forEach(function(value){ 9 for(x in value.cars) { 10 reducedValue.cars.push(value.cars[x]); 11 } 12 }); 13 return reducedValue; 14 } 15 16 db.getCollection("atc_and_cdc_reduced").mapReduce(map, reduce, {out: "import_data_dealer_cars"} );

      I have a mapreduce job that causes a segfault every time it runs.

      The map seems to work fine, but the reduce causes the following error, which then corrupts the database files

      map=function(){
        var dealer_identifier = this.source+"_"+this.source_dealer_id
        emit(dealer_identifier, {cars: [ {source: this.source, source_id: this.source_id} ] });
      }
      
      reduce=function(key,values){
        reducedValue = {cars: [] };
        values.forEach(function(value){
          for(x in value.cars){
            reducedValue.cars.push(value.cars[x]);
          }
        });
        return reducedValue;
      }
      
      db.getCollection("atc_and_cdc_reduced").mapReduce(map, reduce, {out: "import_data_dealer_cars"});
      

            Assignee:
            benjamin.becker Ben Becker
            Reporter:
            ipatton10000 Ian Patton
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: