No reconnection on replica set

XMLWordPrintableJSON

    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I have this sample application running with a replica set:
      'use strict';

      const MongoClient = require('mongodb').MongoClient;
      
      return MongoClient.connect('mongodb://ip1:port1,ip2:port2,ip3:port3/dbName?replicaSet=testSet', function(err, db) {
          if (err) {
              return console.error('Err:', err);
          }
      
          setInterval(function() {
              console.log('Interval');
      
              return db.collection('tests').count({}, function(err, count) {
                  if (err) {
                      console.error('Err:', err);
                  } else {
                      console.log('Count:', count);
                  }
              });
          }, 2000);
      });
      {

      When I block all the outgoing/incoming connections with a firewall, the Mongo client keeps all the pending outgoing requests in a buffer. Then, when I unblock the connections, nothing happens. It seems the client does not reconnect and the application stays frozen.

      Note: Sometimes there is a reconnection but it's unpredictable.

            Assignee:
            Christian Amor Kvalheim
            Reporter:
            Mathieu Ghennassia
            None
            Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: