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

`SessionsCollectionRS` acquires locks unnecessarily

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.6.0-rc1
    • Affects Version/s: 3.6.0-rc0
    • Component/s: Internal Code
    • Labels:
    • Fully Compatible
    • ALL
    • Platforms 2017-10-23
    • 0

      All usages of dispatch in the sessions collection management utility acquire database/collection locks. My suspicion is that these locks are taken for replica set primary check further down.

      Acquiring these locks has the potential of causing the code executed by DBDirectClient further down to deadlock if it happens to cause lock mode upgrade.

      All of these lock usages other than findRemovedSessions already issue write commands which will fail if the node is not primary, so this is not a problem. For findRemovedSessions, the read will fail because it doesn't have the slaveOk bit set, so this is not a problem either.

      Based on this I think it is safe to remove the lock acquisitions from dispatch altogether, which would simplify the code.

            samantha.ritter@mongodb.com Samantha Ritter (Inactive)
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            0 Vote for this issue
            6 Start watching this issue