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

MongoClient.connect hangs occasionally

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial - P5
    • Resolution: Won't Fix
    • Affects Version/s: 2.2.33, 2.2.34
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      node v6.10
      typescript, run via ts-node
      mongodb-core 2.1.19
      mongodb 2.2.35

      Description

      Hello,

      I am attempting to connect to mongodb using the following code

      import * as mongodb from 'mongodb';
      console.log('Attempting connection...');
      const dbPromise = mongodb.MongoClient.connect(mongodbUrl);
      dbPromise.then(() => {
        console.log('connected!');
      });
      

      I am on node v6.10, and started with the following libraries:

      mongodb-core 2.1.17
      mongodb 2.2.33
      

      When running the above code, I would intermittently get the following error:

      (node:76520) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): MongoError: no connection available
      

      In the process of trying to address this issue, I upgraded my driver:

      mongodb-core 2.1.19
      mongodb 2.2.35
      

      Now, the connection promise neither fails nor resolves. I ran this with `loggingLevel: 'debug'`, and got the output in mongolog.txt (attached).

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            dlants Denis Lantsman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: