CursorManager attempts to dispose of aggregation cursors while holding partitioned lock, which leads to deadlock

XMLWordPrintableJSON

    • Fully Compatible
    • ALL
    • v3.6
    • Query 2018-05-07, Query 2018-05-21
    • 19
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Attempting to acquire a LockManager lock while holding a mutex is prone to deadlock. The CursorManager::killCursor() function locks the partition of CursorManager::_cursorMap corresponding to the specified cursor id. While holding the mutex, it calls ClientCursor::dispose(), which for an aggregation cursor attempts to acquire the collection lock in DocumentSourceCursor::cleanupExecutor() as part of DocumentSourceCursor::doDispose(). The "listCollections" and "listIndexes" commands hold the collection lock when attempting to call CursorManager::registerCursor(), forming the other edge of the deadlock cycle.

              Assignee:
              Charlie Swanson
              Reporter:
              Max Hirschhorn
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: