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

`useUnifiedTopology` continuously emits 'close' event when replica set member is down

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.3.4
    • Affects Version/s: 3.3.3
    • Component/s: None
    • Labels:

      This issue appeared in v3.3.3. The below script prints 'Emitted close' over and over:

      'use strict';
        
      const mongodb = require('mongodb');
      
      run().catch(error => console.log('Caught', error));
      
      async function run() {
        const uri = 'mongodb://localhost:27017,localhost:27018,localhost:27019/test?replicaSet=rs';
        const client = await mongodb.MongoClient.connect(uri, {
          useNewUrlParser: true,
          useUnifiedTopology: true
        });
        console.log('Connected');
        
        client.on('close', () => console.log('Emitted close'));
      }
      

      If it either connects to a replica set when one member is down, or if it loses connectivity to a member of a replica set.

      Related to: https://github.com/Automattic/mongoose/issues/8224

            Assignee:
            matt.broadstone@mongodb.com Matt Broadstone
            Reporter:
            val@karpov.io Valeri Karpov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: