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

ReshardingDonorOplogIterator must call Pipeline::dispose() if Pipeline::getNext() throws

    XMLWordPrintableJSON

Details

    • Fully Compatible
    • ALL
    • v5.0
    • Sharding 2021-06-28
    • 170
    • 1

    Description

      If this call to Pipeline::getNext() throws, then it is possible for the PlanExecutor underlying the Pipeline's DocumentSourceCursor to still be holding locks while the OperationContext is destructed.

      We should add a guard around the call to ReshardingDonorOplogIterator::_fillBatch() to call Pipeline::dispose() if Pipeline::getNext() throws.

      auto guard = makeGuard([&] { pipeline->dispose(opCtx); pipeline.reset() });
      pipeline->reattachToOperationContext(opCtx);
      auto doc = pipeline->getNext();
      pipeline->detachFromOperationContext();
      guard.dismiss();
      

      Attachments

        Issue Links

          Activity

            People

              max.hirschhorn@mongodb.com Max Hirschhorn
              max.hirschhorn@mongodb.com Max Hirschhorn
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: