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

Reverse mutex acquisition order in CatalogCache::_scheduleDatabaseRefresh

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 4.0.10, 4.2.0-rc1
    • 4.0.11, 4.2.0-rc3, 4.3.1
    • Sharding
    • None
    • Fully Compatible
    • ALL
    • v4.2, v4.0
    • Sharding 2019-07-15

    Description

      CatalogCache::_mutex -> ShardServerCatalogCacheLoader::_mutex order:

      CatalogCache::_scheduleDatabaseRefresh has catalog cache mutex and calls getDatabase:
      https://github.com/mongodb/mongo/blob/2393ed14199eddebe25e56bc0a8fe1d47f2297cf/src/mongo/s/catalog_cache.cpp#L532

      which will take the ShardServerCCL _mutex at the beginning of the call.

      ShardServerCCL::_mutex -> CatalogCache::_mutex order:

      Inside the async task lamda we take the ShardServerCCL mutex then tries to run a callback:
      https://github.com/mongodb/mongo/blob/2393ed14199eddebe25e56bc0a8fe1d47f2297cf/src/mongo/db/s/shard_server_catalog_cache_loader.cpp#L460

      And the callback tries to get the CatalogCache::_mutex:

      https://github.com/mongodb/mongo/blob/2393ed14199eddebe25e56bc0a8fe1d47f2297cf/src/mongo/s/catalog_cache.cpp#L523

      Attachments

        Activity

          People

            kaloian.manassiev@mongodb.com Kaloian Manassiev
            randolph@mongodb.com Randolph Tan
            Votes:
            0 Vote for this issue
            Watchers:
            12 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: