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

replSetSyncFrom can cause deadlock between ReplicationCoordinator and InitialSyncer

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Replication
    • ALL
    • Repl 2018-07-02

      The InitialSync::_fcvFetcherCallback function acquires the InitialSync mutex and then acquires the ReplicationCoordinator mutex. This ordering is inconsistent with some functions in ReplicationCoordinator e.g. ReplicationCoordinatorImpl::processReplSetSyncFrom and ReplicationCoordinatorImpl::processReplSetGetStatus. At the time of writing this, the ReplicationCoordinator mutex acquisition was elimiinated in processReplSetGetStatus by SERVER-34758. The potential deadlock with processReplSetSyncFrom is mostly addressed already in SERVER-28840.

      -------------------------

      Original Coverity Description:

      Threads may try to acquire two locks in different orders, potentially causing deadlock

      Defect 103597 (STATIC_C)
      Checker ORDER_REVERSAL (subcategory none)
      File: /src/mongo/db/repl/initial_syncer.cpp
      Function mongo::repl::InitialSyncer::_fcvFetcherCallback(const mongo::StatusWith<mongo::Fetcher::QueryResponse> &, std::shared_ptr<mongo::repl::CallbackCompletionGuard<mongo::StatusWith<mongo::repl::OpTimeWith<long long>>>>, const mongo::repl::OpTimeWith<long long> &)

            Assignee:
            william.schultz@mongodb.com Will Schultz
            Reporter:
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: