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

Reverse mutex acquisition order in CatalogCache::_scheduleDatabaseRefresh

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 4.0.10, 4.2.0-rc1
    • Fix Version/s: 4.0.11, 4.2.0-rc3, 4.3.1
    • Component/s: Sharding
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v4.2, v4.0
    • Sprint:
      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

            • Votes:
              0 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: