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

ReplicaSetChangeNotifier::onConfirmedSet is unsafe during shutdown

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v4.4, v4.2
    • Sprint:
      Service arch 2020-04-20
    • Linked BF Score:
      23

      Description

      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);
          };
      

        Attachments

          Activity

            People

            Assignee:
            janna.golden Janna Golden
            Reporter:
            jason.carey Jason Carey
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: