ScopedTaskExecutor schedule during underlying executor shutdown causes use after move invariant to fire

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Server Programmability
    • ALL
    • Programmability 2025-08-18, Programmability 2025-09-01
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      void TaskExecutor::schedule(OutOfLineExecutor::Task func) {
          ...
          auto statusWithCallback = scheduleWork(std::move(cb));
          if (!statusWithCallback.isOK()) {
              CallbackArgs args(this, {}, statusWithCallback.getStatus(), nullptr);
              invariant(cb);  // NOLINT(bugprone-use-after-move)
              cb(args);       // NOLINT(bugprone-use-after-move)
          }
      }  

      The use after move invariant in TaskExecutor::schedule will fire anytime schedule is called for a ScopedTaskExecutor (that is not in shutdown) wrapping a ThreadPoolTaskExecutor (that is in shutdown).

       


       

      Investigate alternatives to use after move in TaskExecutor::schedule, or change ScopedTaskExecutor::_wrapCallback so that a returned non okay status means the callback was never moved from.

            Assignee:
            Ronald Steinke
            Reporter:
            Alex Li
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: