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

Avoid doing work in Client lock when destroying OperationContextSession

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.3
    • Affects Version/s: None
    • Component/s: Replication
    • None
    • Fully Compatible
    • ALL
    • Repl 2018-08-27, Repl 2018-09-10
    • 11

      When OperationContextSession is destroyed, it destroys the operationSessionDecoration on the OperationContext under the Client lock.  Destroying the operationContextDecoration (which is a ScopedCheckedOutSession) takes the SessionCatalog mutex.  Other code takes the SessionCatalog mutex and then the Client lock (implicitly in waitForConditionOrInterruptUntil) so this causes deadlocks.

      Instead we should take the Client lock, move the ScopedCheckedOutSession from the operationSessionDecoration to a local variable, then release the Client lock and destroy the ScopedCheckedOutSession without the lock.

            Assignee:
            matthew.russotto@mongodb.com Matthew Russotto
            Reporter:
            matthew.russotto@mongodb.com Matthew Russotto
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: