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

Nodejs driver 6.0 cannot keep the connections alive

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 6.0.0
    • Component/s: Load Balancer
    • 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?

      Node driver: 6.0 or above
      NodeJs: V20 or above
      OS: Windows 10

      We have a self-managed mongodb cluster deployed in AKS container. The nodejs application connects to this mongo instance via a external IP provided by LoadBalancer service. The connection used to work very well when we used node driver 5.3 and nodejs 16.14. After we upgraded driver to 6.5 and nodejs to 20.11 connections in mongo connection pool were closed constantly after they were idle for around 4 minutes. I subscribed connectionClosedEvent to monitor mongo connection pool. I can see connectionClosedEvents constantly after connection pool was created soon. Along with these events were "read ECONNRESET" exceptions.
      This issue only occurs when our nodejs application connects mongodb instance from windows. Connection from Linux is ok.
      I know that LoadBalancer has 4 minutes idle time out. And after 4 minutes LoadBalancer will reset socket connections. This is probably the cause why connections were closed. But I think driver should send keepAlive packets to keep connections alive with interval shorter than 4 minutes. We didn't catch keepAlive packets.

        1. package.json
          0.0 kB
        2. mongodbx.yaml
          1 kB
        3. econnresetRep.js
          5 kB

            Assignee:
            Unassigned Unassigned
            Reporter:
            qingchun.fu@kodak.com qingchun fu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: