Under load, mongoDB queries may result in maximum call stack exceeded error

Hi guys,

So I’ve been using mongoDB in my meteor app for many years now. I also quite frequently use the initializeUnorderedBulkOp() method to create performant bulk operations.

For some weeks now I am quite frequently running into very weird problems: Under quite heavy load (e.g. while multiple long, more complicated queries are running in parallel) some completely normal queries suddenly result in an JS error thrown from the nodejs mongo driver - the error is the typical Maximum call stack exceeded error - unfortunately the exact logs are gone by now. :confused:
I can still be remember that the error occurred in some method named fixed_queue for something.

Anyways this obviously crashes my whole node server so I desperately need a fix for that!

I am using the mongodb npm package in version 3.6.6.

Can someone help?
Thanks, best, Patrick

Okay, so I found the full error again:

RangeError: Maximum call stack size exceeded
at ClientSession.emit (events.js:1:-61)
at ClientSession.EventEmitter.emit (domain.js:483:12)
at completeEndSession (/built_app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/sessions.js:142:17)
at /built_app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/sessions.js:157:7
at maybePromise (/built_app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/utils.js:685:3)

I really hope someone can help?!