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

ReplicaSetChangeNotifier::onConfirmedSet is unsafe during shutdown

    • Fully Compatible
    • ALL
    • v4.4, v4.2
    • Service arch 2020-04-20
    • 23

      The replica set change notifier makes a copy of _listeners under a lock, but then invokes onConfirmedSet on those listeners outside the lock. During shutdown, those pointers can be dead, which can cause us to use after free and crash.

      See replica_set_change_notifier.cpp#L116-L120

          auto listeners = _listeners;
          lk.unlock();
      
          for (auto listener : listeners) {
              listener->onConfirmedSet(state);
          };
      

            Assignee:
            janna.golden@mongodb.com Janna Golden
            Reporter:
            mira.carey@mongodb.com Mira Carey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: