Fix dangling pointer to OperationContext in PipelineOptimizationTest

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.1.0-rc0
    • Affects Version/s: 8.1.0-rc0
    • Component/s: Aggregation Framework
    • None
    • Catalog and Routing
    • Fully Compatible
    • CAR Team 2025-03-03
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      pipeline_test.cpp contains a assertPipelineOptimizesTo function which constructs and returns a Pipeline instance.

       

      To construct it, assertPipelineOptimizesTo creates a local-scoped OperationContext which is associated to the ExpressionContext for that Pipeline. But since the OperationContext is local-scoped, it is destroyed when the function returns, which means that the Pipeline returned by the function contains a dangling pointer to the destroyed OperationContext.

       

      Currently this is harmless, however as part of SPM-4048 we intend to use that OperationContext to check feature flags, so we need to ensure that the lifetime of the Pipeline is contained within that of the OperationContext.

              Assignee:
              Joan Bruguera Micó
              Reporter:
              Joan Bruguera Micó
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: