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

XMLWordPrintableJSON

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

      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
              Reporter:
              Blake Oler
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: