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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Fixed
    • Affects Version/s: 3.4.8
    • Fix Version/s: 3.2.17, 3.4.9, 3.5.13
    • Component/s: JavaScript
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v3.4, v3.2
    • Sprint:
      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

              • Votes:
                0 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: