Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-3928

Windows: Uncaught exception when connecting to closed port with large minPoolSize

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 4.6.0
    • Affects Version/s: 4.3.1, 4.3.0
    • Component/s: None
    • 2
    • Not Needed

      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)
      
      

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            mika.fischer@zoopnet.de Mika Fischer
            Bailey Pearson
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: