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

DatabaseShardingState inappropriately constructs a RESOURCE_MUTEX ResourceId, leading to uncaught exception

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Concurrency, Sharding
    • None
    • Fully Compatible
    • ALL
    • 137

      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.

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

              Created:
              Updated:
              Resolved: