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

Aggregation plan executors should be owned by global cursor manager

    • Fully Compatible
    • ALL
    • Query 11 (03/14/16), Query 2016-11-21, Query 2016-12-12, Query 2017-02-13, Query 2017-03-27
    • 15

      Plan executors that own a PipelineProxyStage do not hold a collection lock while they are being iterated. However, all executors that are eligible for kill notifications must hold a lock while they are being iterated, as concurrent access to PlanExecutor::_killReason for registered PlanExecutor objects is protected by the collection lock.

      As a result, if a plan executor owning a PipelineProxyStage executor is killed during execution, then the executor's call to read _killReason from PlanExecutor::killed() will race with the killing thread's call to write _killReason from PlanExecutor::kill(). This is undefined behavior, and potentially can result in a server crash.

      Aggregation cursors and plan executors should be owned by the global cursor manager, instead of by the collection's cursor manager. This correctly captures the fact that the lifetime of an aggregation cursor/executor is not tied to the lifetime of the collection, and this will prevent these cursors/executors from receiving kill notifications.

      The underlying plan executor owned by DocumentSourceCursor should remain owned by the associated collection's cursor manager, and should be registered for receiving invalidations and kill notifications.

            Assignee:
            charlie.swanson@mongodb.com Charlie Swanson
            Reporter:
            rassi J Rassi
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: