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

Investigate NODE-3928 - Windows: Uncaught exception when connecting to closed port with large minPoolSize

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • 3
    • Not Needed

      NODE-3928 Description

      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:
            bailey.pearson@mongodb.com Bailey Pearson
            Reporter:
            dbeng-pm-bot PM Bot
            Bailey Pearson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: