Reverse mutex acquisition order in CatalogCache::_scheduleCollectionRefresh

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 3.6.14, 4.0.11
    • Affects Version/s: 3.6.13, 4.0.10
    • Component/s: Sharding
    • None
    • Fully Compatible
    • ALL
    • v3.6
    • Sharding 2019-07-15
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      CatalogCache::_scheduleCollectionRefresh holds CatalogCache::_mutex while calling ShardServerCatalogCacheLoader::getsChunkSince, which will try to grab ShardServerCCL::_mutex at the beginning:
      https://github.com/mongodb/mongo/blob/r4.0.10/src/mongo/s/catalog_cache.cpp#L603

      Inside async task, tries to run callback while holding ShardServerCLL::_mutex:
      https://github.com/mongodb/mongo/blob/r4.0.10/src/mongo/db/s/shard_server_catalog_cache_loader.cpp#L416

      and the callback tries to grab the CatalogCache::_mutex:
      https://github.com/mongodb/mongo/blob/r4.0.10/src/mongo/s/catalog_cache.cpp#L577

            Assignee:
            Kaloian Manassiev
            Reporter:
            Randolph Tan
            Votes:
            0 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved: