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

ServerDiscoveryMonitor::shutdown can lead to deadlock

    • Fully Compatible
    • ALL
    • Service arch 2020-12-28
    • 38

      In a callback for TaskExecutor::scheduleRemoteCommand here, we try to acquire a mutex.
      This is a problem because in ServerDiscoveryMonitor::shutdown, we acquire the mutex before canceling the remaining tasks in the executor and shutting down the executor, and either cancellation or shutdown+join can cause the callbacks to run, leading to a deadlock.

      We should either reset the executor pointer and cancel the handles outside of the lock, or check the status passed into the callback for scheduleRemoteCommand and only acquire the mutex if it's an OK status.

            Assignee:
            matthew.saltz@mongodb.com Matthew Saltz (Inactive)
            Reporter:
            matthew.saltz@mongodb.com Matthew Saltz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: