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

Do not hold replication mutex when calling getMinValid

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6.7, 4.0.2, 4.1.2
    • Component/s: Replication
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v4.0, v3.6
    • Sprint:
      Repl 2018-08-13
    • Linked BF Score:
      63

      Description

      It is not valid to read collections while holding the replication mutex. The reason is that reading a collection takes the global lock, which may be held by another thread, and that thread may be waiting on the replication mutex (e.g. by calling getMyLastAppliedOpTime).

      Thus, _replicationProcess->getConsistencyMarkers->getMinValid must not be called with the replication mutex held, as it is in _finishLoadLocalConfig.

      I believe we may simply release the repl mutex before checking !lastOpTime.isNull()

      https://github.com/mongodb/mongo/blob/960fca37a78040d75d87f8049ef4c4a6227506cc/src/mongo/db/repl/replication_coordinator_impl.cpp#L598

      Then re-acquire after calling getMinValid() (and remove the else clause).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tess.avitabile Tess Avitabile
              Reporter:
              matthew.russotto Matthew Russotto
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: