-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Labels
underlying library issueThis issue is a bug with an underlying library, like the MongoDB driver or mongodb-coreThis issue is a bug with an underlying library, like the MongoDB driver or mongodb-core
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Mongoose version
8.1.1
Node.js version
20.x
MongoDB server version
6.x
Typescript version (if applicable)
5.1.6
Description
when using a mongoose stream, I cannot catch an initial error, it always kills the proess with an "uncaught exception".
following (pseudo) code:
const stream = someCollectionl.find().sort({'_id': -1}).stream({transform})
stream.on('error', err => console.error(err));
throws with
uncaughtException MongoServerError: Encountered non-retryable error during query :: caused by :: PlanExecutor error during aggregation :: caused by :: Sort exceeded memory limit of 104857600 bytes, but did not opt in to external sorting.
at Connection.onMessage (/home/simon/Dev/hokify/hokify/node_modules/.pnpm/[email protected][email protected]/node_modules/mongodb/src/cmap/connection.ts:421:18)
at MessageStream.<anonymous> (/home/simon/Dev/hokify/hokify/node_modules/.pnpm/[email protected][email protected]/node_modules/mongodb/src/cmap/connection.ts:251:56)
at MessageStream.emit (node:events:517:28)
at MessageStream.emit (node:domain:489:12)
at processIncomingData (/home/simon/Dev/hokify/hokify/node_modules/.pnpm/[email protected][email protected]/node_modules/mongodb/src/cmap/message_stream.ts:179:12)
at MessageStream._write (/home/simon/Dev/hokify/hokify/node_modules/.pnpm/[email protected][email protected]/node_modules/mongodb/src/cmap/message_stream.ts:68:5)
at writeOrBuffer (node:internal/streams/writable:392:12)
at _write (node:internal/streams/writable:333:10)
at MessageStream.Writable.write (node:internal/streams/writable:337:10)
at Socket.ondata (node:internal/streams/readable:777:22)
at Socket.emit (node:events:517:28)
at Socket.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:335:12)
at readableAddChunk (node:internal/streams/readable:308:9)
at Socket.Readable.push (node:internal/streams/readable:245:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
ok: 0,
code: 292,
codeName: 'QueryExceededMemoryLimitNoDiskUseAllowed',
I played around with it and couldn't find any way how to catch this error.
Steps to Reproduce
run a query that results into QueryExceededMemoryLimitNoDiskUseAllowed by simple using some big collection and putting a sort on it.
Expected Behavior
the error should be catchable.
Metadata
Metadata
Assignees
Labels
underlying library issueThis issue is a bug with an underlying library, like the MongoDB driver or mongodb-coreThis issue is a bug with an underlying library, like the MongoDB driver or mongodb-core