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

Use of "scope" field in mapReduce triggers BSONObj ownership error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical - P2
    • Resolution: Fixed
    • 3.4.8
    • 3.2.17, 3.4.9, 3.5.13
    • JavaScript
    • Fully Compatible
    • ALL
    • v3.4, v3.2
    • Platforms 2017-09-11

    Description

      "scope" allows a user to provide a map of global variables to expose to all JS functions ran during a mapReduce job. However, we do not take an owned copy of the map from the command. If scope contains an object, this triggers the memory protection mechanisms added in SERVER-30875.

      MongoDB Enterprise > db.runCommand({mapReduce: "foo", map: function(x) {return emit("hello", 1);}, reduce: function(x) { return 0; }, scope: {x: {x: function() {return 5;}}}, out: "bar"})
      {
              "ok" : 0,
              "errmsg" : "Attempt to bind an unowned BSON Object to a JS scope marked as requiring ownership",
              "code" : 2,
              "codeName" : "BadValue"
      }
      

      Attachments

        Issue Links

          Activity

            People

              spencer.jackson@mongodb.com Spencer Jackson
              spencer.jackson@mongodb.com Spencer Jackson
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: