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

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

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              charlie.swanson@mongodb.com Charlie Swanson
              max.hirschhorn@mongodb.com Max Hirschhorn
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: