ReplicaSetChangeNotifier::onConfirmedSet is unsafe during shutdown

XMLWordPrintableJSON

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

      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
              Reporter:
              Mira Carey
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: