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

Prevent future util's whenAllSuceed from throwing ErrorCodes::BrokenPromise on executor shutdown

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Server Programmability
    • ALL

      Repro:

      TEST_F(WhenAllSucceedTest, DoesNotReturnBrokenPromiseIfExecutorShutdownWhileWaiting) {
          // create a future waits on a barrier
      
          const auto kNumInputs = 5;
          auto [inputPromises, rawInputFutures] = makePromisesAndFutures<void>(kNumInputs);
      
          // Turn raw input Futures into ExecutorFutures.
          std::vector<ExecutorFuture<void>> inputFutures;
          for (auto i = 0; i < kNumInputs; ++i) {
              inputFutures.emplace_back(std::move(rawInputFutures[i]).thenRunOn(executor()));
          }
      
          auto result = whenAllSucceed(std::move(inputFutures));
      
          executor()->shutdown();
      
          for (auto i = 0; i < kNumInputs; ++i) {
              inputPromises[i].emplaceValue();
          }
      
          result.get();
      }
      

      Can be solved in the same manner as SERVER-54735.

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

              Created:
              Updated: