-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 4.3.1, 4.3.0
-
Component/s: None
What problem are you facing?
The mongodb nodejs driver causes an ungcaught exception crashing the whole process.
What driver and relevant dependency versions are you using?
Windows 11, node 16.13.2, mongodb 4.3.1
Steps to reproduce?
import { MongoClient } from 'mongodb'; process.on('uncaughtExceptionMonitor', () => console.error('\nUNCAUGHT EXCEPTION, going down in flames...\n')); try { await MongoClient.connect('mongodb://127.0.0.1:24242/', { minPoolSize: 50 }); } catch (err) { console.error('Caught mongodb error:', err); }
gives
psh ❯ node .\index.mjs UNCAUGHT EXCEPTION, going down in flames... C:\Users\mfischer\src\tests\node-mongo-crash\node_modules\mongodb\lib\cmap\commands.js:368 this.documents = new Array(this.numberReturned); ^ RangeError: Invalid array length at new Response (C:\Users\mfischer\src\tests\node-mongo-crash\node_modules\mongodb\lib\cmap\commands.js:368:26) at processIncomingData (C:\Users\mfischer\src\tests\node-mongo-crash\node_modules\mongodb\lib\cmap\message_stream.js:108:32) at MessageStream._write (C:\Users\mfischer\src\tests\node-mongo-crash\node_modules\mongodb\lib\cmap\message_stream.js:28:9) at writeOrBuffer (node:internal/streams/writable:389:12) at _write (node:internal/streams/writable:330:10) at MessageStream.Writable.write (node:internal/streams/writable:334:10) at Socket.ondata (node:internal/streams/readable:754:22) at Socket.emit (node:events:390:28) at addChunk (node:internal/streams/readable:315:12) at readableAddChunk (node:internal/streams/readable:289:9)