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

OperationIdManager::~ClientState() mutex acquisition races with LatchAnalyzer::~LatchSetState

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Fully Compatible
    • ALL
    • Service Arch 2023-12-11
    • 162

      Both OperationIdManager and LatchAnalyzer, which are both ServiceContext decorations, have related client decorations, ClientState and LatchSetState. When we destroy a client object and are destroying all of its decorations, we do two things in an undefined order:

      • We destroy the LatchSetState decoration on the Client
      • We destroy the OperationIdManager::ClientState decoration, during which we acquire a mutex on the OperationIdManager, which triggers the LatchAnalyzer to be run for that mutex. However, if the LatchSetState has already been destroyed on the Client, then we when encounter undefined behavior, and the program aborts.

      We can fix this by making the OperationIdManager use a stdx::mutex, to avoid triggering the LatchAnalyzer.

            erin.mcnulty@mongodb.com Erin McNulty
            erin.mcnulty@mongodb.com Erin McNulty
            0 Vote for this issue
            2 Start watching this issue