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

InitialSyncer::_startupComponent should reset 'component' before returning CallbackCanceled due to shutdown

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 3.4.4, 3.5.6
    • 3.4.6, 3.5.7
    • Replication
    • None
    • Fully Compatible
    • 15

    Description

      _startupComponent currently resets the unique_ptr if the component's startup() returns an error but not when the parent component is shutting down. This usually doesn't pose a problem except when the sub component is holding some resource that needs to be released if we decide not to proceed with calling its startup().

      https://github.com/mongodb/mongo/blob/fa2dcc33303dd6a2080c108e121da6984d08a9d6/src/mongo/db/repl/initial_syncer.cpp#L1340

      initial_syncer.cpp

      1337
      template <typename Component>
      1338
      Status InitialSyncer::_startupComponent_inlock(Component& component) {
      1339
          if (_isShuttingDown_inlock()) {
      1340
              return Status(ErrorCodes::CallbackCanceled,
      1341
                            "initial syncer shutdown while trying to call startup() on component");
      1342
          }
      1343
          auto status = component->startup();
      1344
          if (!status.isOK()) {
      1345
              component.reset();
      1346
          }
      1347
          return status;
      1348
      }
      

      Attachments

        Issue Links

          Activity

            People

              benety.goh@mongodb.com Benety Goh
              benety.goh@mongodb.com Benety Goh
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: