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

Connection lock blocks reconnection after topology closed

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • 2
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      What problem are you facing?

      https://github.com/mongodb/node-mongodb-native/pull/3596 added a welcome fix to stop topologies leaking (which we've previously been working around).

      However, it doesn't address another issue we've seen with this sort of lock, which is that if the topology is closed during connection, a reconnection attempt never resolves.

      This is probably easiest to describe with a (currently failing) test case:

      it('releases the lock if the topology is closed before connection is complete', function (done) {
        client.connect();
        client.close();
        client.once('topologyClosed', async () => {
          await client.connect();
          expect(client.topology?.isConnected()).to.be.true;
          done();
        });
      }); 

      The above test case will currently timeout (ie the reconnection is never resolved).

      What driver and relevant dependency versions are you using?

      This is the bleeding-edge version on main (not yet released).

      Steps to reproduce?

      See above test case.

            Assignee:
            Unassigned Unassigned
            Reporter:
            alec@reedys.com Alec Gibson
            Durran Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: