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

Data race on ReplicaSetMonitorManager::_stats

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0, 6.0.16, 7.0.10, 8.0.0-rc3
    • Affects Version/s: None
    • Component/s: None
    • None
    • Service Arch
    • Fully Compatible
    • ALL
    • v8.0, v7.0, v6.0
    • Service Arch 2024-04-15, Service Arch 2024-04-29
    • 122

      The ReplicaSetMonitorManager::_stats member can be concurrently accessed from different threads without synchronization, i.e. via report() where it is read without synchronization.
      This member has type shared_ptr<ReplicaSetMonitorManager> - note that while the pointed-to object is thread-safe/synchronized, the shared_ptr object itself still requires synchronization, and cannot be accessed concurrently by different threads (one of which writes/mutates it) without additional synchronization.

      We should fix it by either gating access with the ReplicaSetMonitorManager::_mutex or using the new c++20 atomic<shared_ptr>

            Assignee:
            george.wangensteen@mongodb.com George Wangensteen
            Reporter:
            george.wangensteen@mongodb.com George Wangensteen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: