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

DatabaseShardingState inappropriately constructs a RESOURCE_MUTEX ResourceId, leading to uncaught exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Done
    • None
    • None
    • Concurrency, Sharding
    • None
    • Fully Compatible
    • ALL
    • 137

    Description

      The changes from a383a13 as part of SERVER-69434 changed DatabaseShardingState to construct a ResourceId(RESOURCE_MUTEX, dbName). Constructing a RESOURCE_MUTEX ResourceId outside of ResourceIdFactory is a violation of ResoureceIdFactory::nameForId(). The RESOURCE_MUTEX ResourceType is a lock type designed to use the position within the ResoureceIdFactory::labels vector as the hash of the ResourceId. ResourceId(RESOURCE_MUTEX, dbName) will take the hash of the database name and therefore be very unlikely to correspond to an element within the ResoureceIdFactory::labels vector.

      ResourceId::toString() is called when the lock cannot be acquired within the allotted time and leads to an uncaught std::out_of_range exception.

      Attachments

        Issue Links

          Activity

            People

              jordi.serra-torrens@mongodb.com Jordi Serra Torrens
              max.hirschhorn@mongodb.com Max Hirschhorn
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: