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

Top keeps state about operations against non-existent collections

    • Fully Compatible
    • ALL
    • Storage NYC 2018-07-02, Storage NYC 2018-07-16, Storage NYC 2018-07-30

      The Top singleton object keeps state about find/update/remove operations against non-existent collections. This is unexpected.

      If a malfunctioning or malicious client repeatedly issues queries against unique non-existent collections, the "top" command will start to return an error after the size of the response object exceeds the maximum size of a BSON object, and the Top usage map will grow to an arbitrary size in memory. This memory can be reclaimed with a restart of the mongod process.

      Reproduce with the following script:

      db.dropDatabase();
      db.foo.find().itcount();
      db.baz.update({}, {$set: {a: 1}});
      db.bar.remove({});
      var res = db.adminCommand("top");
      assert.isnull(res.totals["test.foo"]);  // Trips: unexpected.
      assert.isnull(res.totals["test.bar"]);  // Trips: unexpected.
      assert.isnull(res.totals["test.baz"]);  // Trips: unexpected.
      

            Assignee:
            sean.tao Sean Tao
            Reporter:
            rassi J Rassi
            Votes:
            0 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved: