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

Don't invariant that resharding machine completion promises are fulfilled on destruction

    XMLWordPrintable

Details

    • Fully Compatible
    • ALL
    • v5.0
    • Sharding 2021-05-31
    • 50
    • 1

    Description

      Background:

       

      Quote from Max Hirschhorn on Slack:

       

      I noticed while debugging a unit test failure for one of the resharding primary-only services that Instance::run() is scheduled as a task within the _scopedExecutor. This means it is possible for the following sequence to occur:

      1. getOrCreate() is called and caller now holds shared_ptr<Instance>
      2. _insertNewInstance() schedules task to call Instance::run() but it doesn't run yet due to thread scheduling
      3. stepdown occurs
      4. _scopedExecutor is shut down and won't run any tasks
      5. Instance::run() is never called

       

      Symptoms:

      The completion promise is never fulfilled because Instance::run() is never called. This trips the invariant that the completion promise is fulfilled.

      Solution:

      Remove the invariant. It's okay for the completion promise to not be fulfilled if the _scopedExecutor has not called Instance::run().

      Attachments

        Activity

          People

            blake.oler@mongodb.com Blake Oler
            blake.oler@mongodb.com Blake Oler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: