Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-3282

Excessive heartbeats in polling mode

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: SDAM
    • None
    • Go Drivers
    • 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?

      Detailed steps to reproduce the problem?

      Hello all! Hope everyone is well

      Dan Gottlieb discovered what we think is a bug in the polling logic for server monitoring. In particular, when we upgraded to any version of the Go driver beyond (and including) v1.13.0, we found that our DBs got hit with an excessive amount of heartbeats (tens of thousands per second). We traced the issue to this commit: reverting that commit brings heartbeats back to a much more reasonable frequency.

      We are wondering if there is a small typo in this predicate. Instead of:

      if isStreamable(s) || connectionIsStreaming || transitionedFromNetworkError {
                  continue
      }
      

      Should it be:

      if (isStreamable(s) && connectionIsStreaming) || transitionedFromNetworkError {
                  continue
      } 
      

      The former (what's in the driver currently) seems to continue and not wait for a heartbeat interval if streaming is possible for the current server OR the connection we're using is streaming. Shouldn't we only continue and not wait for a heartbeat interval if streaming is possible for the current server AND the connection we're using is streaming?

      Thanks, and let me know if you need any other information.

      Definition of done: what must be done to consider the task complete?

      Change the predicate as described above.

      The exact Go version used, with patch level:

      $ go version

      go version go1.22.5 linux/amd64

      The exact version of the Go driver used:

      $ go list -m go.mongodb.org/mongo-driver

      v1.13.0.

      Describe how MongoDB is set up. Local vs Hosted, version, topology, load balanced, etc.

      Hosted, version 6.0, replica-set (and sharded in some cases).

      The operating system and version (e.g. Windows 7, OSX 10.8, ...)

      Linux (probably ubuntu; I can check distro + version if this is important).

            Assignee:
            preston.vasquez@mongodb.com Preston Vasquez
            Reporter:
            benji.rewis@viam.com Benji Rewis
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: