Bugs in single-threaded selection timeout

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 1.4.0
    • Affects Version/s: 1.3.0
    • Component/s: libmongoc
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Two bugs with mongoc_topology_select in 1.3.x when serverSelectionTryOnce is turned off.

      Bug #1: instead of sleeping a half second between server checks, mongoc_topology_select sleeps half a second longer between each server check until the next sleep would exceed the server selection timeout.

      Consider the 1.3.5 code in mongoc_topology_select. "try_once" is false, connectTimeoutMS is 500, socketTimeoutMS is 60,000:

      /* call the start time "0" */
      loop_start = loop_end = 0
      expire_at = 30 seconds
      next_update = something negative
      topology->stale = true
      
      first loop iteration:
      scan_ready = something negative
      sleep_usec = something negative
      spend, let's say, 5 ms in _mongoc_topology_do_blocking_scan
      topology->last_scan = now = 5ms
      
      second loop iteration:
      scan_ready = 505ms
      sleep_usec = 505ms
      sleep for 505ms
      spend 5ms in _mongoc_topology_do_blocking_scan
      topology->last_scan = now = 510ms
      
      third loop iteration:
      scan_ready = 1010ms
      sleep_usec = 1010ms
      sleep for 1010ms
      spend 5ms in _mongoc_topology_do_blocking_scan
      

      Bug #2: when scan_ready has advanced enough to exceed expire_at, the error message should be the standard "serverselectiontimeoutms timed out", not "minheartbeatfrequencyms not reached yet".

            Assignee:
            A. Jesse Jiryu Davis
            Reporter:
            A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: