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

Concurrent aggregations with $out on a shard server can deadlock with each other

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 4.1.3
    • 4.1.6
    • Querying
    • None
    • Fully Compatible
    • ALL
    • Query 2018-11-05, Query 2018-11-19
    • 45

    Description

      A single aggregation request with $out takes:

      • the global lock in IS for a collection lock on the input collection from the client's OperationContext
      • the global lock in IS for a collection lock on config.collections and config.chunks from the ShardServerCatalogCacheLoader from one of the loader's OperationContexts
      • the global lock in X for renameIfOptionsAndIndexesHaveNotChanged() from the client's OperationContext

      Enqueuing a global X lock request blocks all later global lock requests.

      So, if one agg request's global X lock request is enqueued in between a second agg request's two global IS lock requests, the three threads can deadlock.

      I think it also may be possible for any operation that takes a global X lock to deadlock with a single agg with $out? I am not totally sure though, which is why I titled the ticket as I did for now.

      I am not sure whether this affects versions before master, so have just marked it as affecting 4.1.3 for now.

      Attachments

        Activity

          People

            charlie.swanson@mongodb.com Charlie Swanson
            esha.maharishi@mongodb.com Esha Maharishi
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: