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

Ensure TopologyVersionObserver is always interrupted at shutdown

    • Fully Compatible
    • ALL
    • Service Arch 2021-05-17
    • 22

      The shutdown method for ToplogyVersionObserver must interrupt the _workerOpCtx to ensure that the observer thread always returns (see here). However, the observer thread may create a new opCtx after checking if a shutdown is in progress (see here), violating this contract and introducing hangs. A simple fix to address this issue is to check the shutdown flag when holding the mutex and before setting _workerOpCtx.

      {
          // Set the _workerOpCtx to our newly formed opCtxHandle before we unlock.
          stdx::lock_guard lk(_mutex);
          if (_shouldShutdown.load()) break;
          _workerOpCtx = opCtxHandle.get();
      }
      

            Assignee:
            luis.osta@mongodb.com Luis Osta (Inactive)
            Reporter:
            amirsaman.memaripour@mongodb.com Amirsaman Memaripour
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: