feat: upgrade mongodb -> 6.8.0, handle throwing error on closed cursor in Mongoose#14813
Merged
Conversation
hasezoey
requested changes
Aug 18, 2024
Collaborator
hasezoey
left a comment
There was a problem hiding this comment.
Code looks OK, though if we should go with the current solution and not get a answer in the JIRA, then it should likely be noted that the error (class & message) is different.
also the replicaset tests seem to fail consistently even after a re-run:
3 failing
1) Model
bug fixes
3.6 features
watch()
"after each" hook in "watch()":
done() called multiple times in hook <Model bug fixes 3.6 features watch() "after each" hook in "watch()"> of file /home/runner/work/mongoose/mongoose/test/model.test.js; in addition, done() received error: MongoAPIError: ChangeStream is closed
at ChangeStream._processChange (/home/runner/work/mongoose/mongoose/node_modules/mongodb/lib/change_stream.js:309:19)
at ReadableCursorStream.<anonymous> (/home/runner/work/mongoose/mongoose/node_modules/mongodb/lib/change_stream.js:287:46)
at ReadableCursorStream.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at ReadableCursorStream.Readable.push (node:internal/streams/readable:228:10)
at /home/runner/work/mongoose/mongoose/node_modules/mongodb/lib/cursor/abstract_cursor.js:649:26
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
uncaught: true,
[Symbol(errorLabels)]: Set(0) {}
}
Error: done() called multiple times in hook <Model bug fixes 3.6 features watch() "after each" hook in "watch()"> of file /home/runner/work/mongoose/mongoose/test/model.test.js; in addition, done() received error: MongoAPIError: ChangeStream is closed
at ChangeStream._processChange (node_modules/mongodb/lib/change_stream.js:309:19)
at ReadableCursorStream.<anonymous> (node_modules/mongodb/lib/change_stream.js:287:46)
at ReadableCursorStream.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at ReadableCursorStream.Readable.push (node:internal/streams/readable:228:10)
at /home/runner/work/mongoose/mongoose/node_modules/mongodb/lib/cursor/abstract_cursor.js:649:26
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
uncaught: true,
[Symbol(errorLabels)]: Set(0) {}
}
at process.emit (node:events:513:28)
at process._fatalException (node:internal/process/execution:149:25)
2) Model
bug fixes
3.6 features
watch()
watch() close() closes the stream (gh-7022):
Uncaught MongoAPIError: ChangeStream is closed
at ChangeStream._processChange (node_modules/mongodb/lib/change_stream.js:309:19)
at ReadableCursorStream.<anonymous> (node_modules/mongodb/lib/change_stream.js:287:46)
at ReadableCursorStream.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at ReadableCursorStream.Readable.push (node:internal/streams/readable:228:10)
at /home/runner/work/mongoose/mongoose/node_modules/mongodb/lib/cursor/abstract_cursor.js:649:26
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
3) Model
bug fixes
3.6 features
watch()
watch() close() closes the stream (gh-7022):
Error: done() called multiple times in test <Model bug fixes 3.6 features watch() watch() close() closes the stream (gh-7022)> of file /home/runner/work/mongoose/mongoose/test/model.test.js
hasezoey
approved these changes
Aug 21, 2024
Collaborator
hasezoey
left a comment
There was a problem hiding this comment.
LGTM, though same comment as before about the JIRA:
though if we should go with the current solution and not get a answer in the JIRA, then it should likely be noted that the error (class & message) is different.
Collaborator
Author
|
We will make a note in the changelog that the error class and message changed |
This was referenced Sep 19, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
We haven't upgraded to MongoDB Node driver 6.8 because we have a test failure due to a minor breaking change in the driver:
cursor.next()no longer errors out after callingcursor.close(). We reported an issue in the MongoDB Node driver JIRA here: https://jira.mongodb.org/browse/NODE-6255 and the issue is in progress, but I'm thinking that 1) better for Mongoose to enforce this behavior if our tests rely on it, 2) we've already been blocked from upgrading tomongodb@6.8for 6 weeks.Examples