Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-54739

Race in ServerDiscoveryMonitor::requestImmediateCheck could lead to multiple outstanding exhaust requests

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.4.4
    • Component/s: Networking
    • Labels:
      None
    • Service Arch
    • ALL

      When ServerDiscoveryMonitor::requestImmediateCheck is called, in some cases, we attempt to cancel the outstanding hello request and reschedule a new one.

      Cancelling the previous request uses a CallbackHandle object that is set after scheduling the request, which happens after a delay.

      This means the following sequence of events could occur:

      1. A call to ServerDiscoveryMonitor::requestImmediateCheck occurs, which calls _scheduleNextHello
      2. The task it schedules to do the exhaust command hangs before actually scheduling the command and setting the callback handle.
      3. A new call to requestImmediateCheck arrives. It tries to cancel the outstanding request, but the callback handle hasn't actually been set yet.
      4. The first request continues, setting the callback handle, which may or may not overwrite the existing one. Either way we end up with two concurrent exhaust commands running for the same host, one of which is no longer tracked or cancellable.

            Assignee:
            backlog-server-servicearch [DO NOT USE] Backlog - Service Architecture
            Reporter:
            matthew.saltz@mongodb.com Matthew Saltz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: