MongoDB.live, free & fully virtual. June 9th - 10th. Register Now MongoDB.live, free & fully virtual. June 9th - 10th. Register Now

Plan executor error during find - RAM limit exceeded

From time to time we get an “Plan executor error during find command”-error in de mongod.log (see at the end of my message).
I know this is related to a sort operation that used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit will solve the problem.

But our MongoDB replicaset hosts about 150 databases… And I don’t find any databasename mentioned in the error… Any suggestions how to find the related database with this error ?

Line from mongod.log:

Plan executor error during find command: FAILURE, stats: { stage: “PROJECTION”, nReturned: 0, executionTimeMillisEstimate: 70, works: 8821, advanced: 0, needTime: 8820, needYield: 0, saveState: 68, restoreState: 68, isEOF: 0, invalidates: 0, transformBy: { params: 1, type: 1, status: 1, updatedAt: 1, createdAt: 1, id: 1 }, inputStage: { stage: “SORT”, nReturned: 0, executionTimeMillisEstimate: 70, works: 8821, advanced: 0, needTime: 8820, needYield: 0, saveState: 68, restoreState: 68, isEOF: 0, invalidates: 0, sortPattern: { createdAt: -1 }, memUsage: 33555285, memLimit: 33554432, inputStage: { stage: “SORT_KEY_GENERATOR”, nReturned: 8492, executionTimeMillisEstimate: 20, works: 8820, advanced: 8492, needTime: 328, needYield: 0, saveState: 68, restoreState: 68, isEOF: 0, nvalidates: 0, inputStage: { stage: “COLLSCAN”, filter: { $and: [{ user.id: { $eq: “93477ac8-6421-4b34-92f9-a26e7085fef7” } }, { status: { $in: [ 0, 1 ] } } ] }, nReturned: 8492, executionTimeMillisEstimate: 10, works: 8819, advanced: 8492, needTime: 327, needYield: 0, saveState: 68, restoreState: 68, isEOF: 0, invalidates: 0, direction: “forward”, docsExamined: 8818 }}} }

But our MongoDB replicaset hosts about 150 databases… And I don’t find any databasename mentioned in the error… Any suggestions how to find the related database with this error ?

I think you can use mtools’s mlogfilter to query your logs for that specific timestamp and figure the queries running at that period of time. The query’s filter { "$and":[ { "user.id":{ "$eq":“934...ef7” } }, { "status":{ "$in":[ 0, 1 ] } } and sort on { "createdAt":-1 } point to a specific database and collection, typically referred as “namespace”.

Also, the mtool’s mloginfo mongod.log --queries lists all the queries and the associated namespace for query.

1 Like