Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-751

Discovered servers not checked until next scan

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 1.2-beta0
    • Affects Version/s: 1.2.0
    • Component/s: libmongoc
    • None
    • Fully Compatible

      Bug in unreleased implementation of Server Discovery And Monitoring spec.

      The spec requires a single-threaded scan to keep going until all nodes have been checked, including nodes discovered during the scan. But it seems that _mongoc_topology_do_blocking_scan quits once all servers known at the start of the scan are checked. Discovered nodes are added to the topology description, but not checked until the next scan.

      I think mongoc_topology_scanner_add must call mongoc_async_cmd_new to schedule a check during the current scan, instead of deferring it to the next scan.

      Impact: an initial server selection may take longer than necessary, or may fail when it could have succeeded. E.g., if the seed list contains only a secondary, the primary is discovered from the secondary's host list, but not checked until the next scan, 500 ms (minHeartbeatFrequencyMS) later.

      If the new "serverSelectionTryOnce" is enabled in single-threaded mode, the selection actually fails in this scenario when it must succeed.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: