deno: npm:mongodb fails on v1.35.1
I just update my Deno build to v1.35.1 from v1.35.0 and my Fresh app fails occasionally due to failed Mongodb query:
An error occurred during route handling or page rendering. MongoParseError: Invalid message size: 1882601779, max allowed: 67108864
at processIncomingData (file:///home/admin/.cache/deno/npm/registry.npmjs.org/mongodb/5.5.0/lib/cmap/message_stream.js:93:25)
at processIncomingData (file:///home/admin/.cache/deno/npm/registry.npmjs.org/mongodb/5.5.0/lib/cmap/message_stream.js:126:20)
at MessageStream._write (file:///home/admin/.cache/deno/npm/registry.npmjs.org/mongodb/5.5.0/lib/cmap/message_stream.js:33:9)
at writeOrBuffer (ext:deno_node/_stream.mjs:3948:16)
at _write (ext:deno_node/_stream.mjs:3893:14)
at MessageStream.Writable.write (ext:deno_node/_stream.mjs:3896:14)
at TLSSocket.ondata (ext:deno_node/_stream.mjs:3180:26)
at TLSSocket.emit (ext:deno_node/_stream.mjs:1852:9)
at addChunk (ext:deno_node/_stream.mjs:2874:16)
at readableAddChunk (ext:deno_node/_stream.mjs:2853:13) {
[Symbol(errorLabels)]: Set(0) {}
}
I’m not sure this is a bug or not, because I used unofficial build from https://github.com/LukeChannings/deno-arm64.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 3
- Comments: 15 (10 by maintainers)
September 18th
Just ran into the same problem while upgrading Deno. Currently stuck on 1.34.2 because it’s the only version that supports
npm:mongodband doesn’t have this bug.@bartlomieju here’s a minimal and reliable reproduction with the latest version of Deno (1.36.3) and
npm:mongo(5.8.1) and MongoDB server (on Ubuntu 22.04):Some notes:
There are several different types of errors that I get and they occur randomly depending on the data, so I think TillaTheHun0 is correct that there’s some sort of compression/decompression bug that’s feeding MongoDB driver some garbled data:
I am also seeing this issue when upgrading Deno
>1.35.0. I can run code that queries a MongoDB Atlas Cluster on Deno1.35.0that will then intermittently throw errors on Deno1.35.1. It seems a regression was introduced in Deno1.35.1.The issue only arose for me when there were concurrent operations being sent to the Node Mongo Driver ie.
Promise.allThe error produced by the Node Mongo Driver is always either
MongoParseError: Invalid message sizeorBSONError: bad string length in bson.Looking at the release for Deno
1.35.1I am noticing some changes tonode/httpandext/httparound compression. Perhaps that’s related to this issue, as all the errors i’m seeing have to do with messagelength.Here’s a minimal reproduction (it uses the sample dataset provided by MongoDB Atlas, but you can change it to whatever):
I also experience this error intermittently and cannot share a reproduction because it only happens intermittently but here is my stack trace:
EDIT: I also get another error sometimes that I’ll just add here as well:
v1.37 will fix it, you can update to canary (
deno upgrade --canary) which includes the fix.@littledivy Just tested and can verify that it seems to be fixed - thanks!
Thanks for the report. We’ll try to debug it this week.
For now, I don’t think I have any useful reproduction code.
I wrote my website in Fresh, and I served some static resources for my web at a route. The route only reads binary data from mongodb with
collection.findOne({ $or: conditions }). It occasionally fails and the only difference in error messages is the number ofInvalid message sizeinMongoParseError: Invalid message size: 1882601779, max allowed: 67108864.I guess it happens at TLS layer (
TLSSocketin stack trace), but I don’t think my network is tampered with (man in the middle attack, etc.) as it would not occur if I used v1.35.0.v1.35.2 has been released, so I will try with it.