[SERVER-21167] Top keeps state about operations against non-existent collections Created: 27/Oct/15  Updated: 14/Jul/23  Resolved: 23/Jul/18

Status: Closed
Project: Core Server
Component/s: Admin, Storage
Affects Version/s: None
Fix Version/s: 4.1.2

Type: Bug Priority: Major - P3
Reporter: J Rassi Assignee: Sean Tao
Resolution: Done Votes: 0
Labels: neweng, todo_in_code
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-27602 High CPU usage and Error running mong... Closed
Related
related to SERVER-21168 Dropping database does not clear stat... Closed
related to SERVER-44230 Move top_drop.js from noPassthrough t... Closed
related to SERVER-6627 top command should return cursor Backlog
is related to SERVER-78999 Top still keeps state about operation... Open
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Storage NYC 2018-07-02, Storage NYC 2018-07-16, Storage NYC 2018-07-30
Participants:
Case:

 Description   

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.



 Comments   
Comment by Githook User [ 23/Jul/18 ]

Author:

{'name': 'Sean Tao', 'email': 'sean.tao@10gen.com'}

Message: SERVER-21167 Top keeps state about operations against non-existent collections
Branch: master
https://github.com/mongodb/mongo/commit/d9e4d82eb846637063c32fc8e32b337aff208f33

Generated at Thu Feb 08 03:56:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.