[SERVER-74060] Pipeline clone() can lead to dangling opCtx pointers Created: 15/Feb/23  Updated: 06/Nov/23  Resolved: 23/Feb/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.0.0-rc0, 6.0.12

Type: Bug Priority: Critical - P2
Reporter: Ian Boros Assignee: Alyssa Clark
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
related to SERVER-82749 Running nested $lookup on sharded clu... Closed
Assigned Teams:
Query Execution
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v6.0
Sprint: QE 2023-02-20, QE 2023-03-06
Participants:

 Description   

When a pipeline is cloned() with no argument (treated as a null ExpressionContext), some stages will create their own new expression context.

The result is a pipeline where the stages do not share the same ExpressionContext, which is wrong.

This ticket is to
(a) Fix clone() and define what it means to clone a pipeline without a new operation context. What does it mean for DocumentSources with a sub-pipeline?
(c) Add invariants to check that the members of a pipeline are using the same ExpressionContext in various places.



 Comments   
Comment by Githook User [ 06/Nov/23 ]

Author:

{'name': 'Alyssa Wagenmaker', 'email': 'alyssa.wagenmaker@mongodb.com', 'username': 'awagenmaker'}

Message: SERVER-74060 enforce consistent opCtx across all pipeline sources

(cherry picked from commit 5c57a8874e277424a3b993b14c04be60d25b6742)
Branch: v6.0
https://github.com/mongodb/mongo/commit/d2a538e88cde4692f183b560a63a6efbed52e13d

Comment by Githook User [ 23/Feb/23 ]

Author:

{'name': 'Alyssa Wagenmaker', 'email': 'alyssa.wagenmaker@mongodb.com', 'username': 'awagenmaker'}

Message: SERVER-74060 enforce consistent opCtx across all pipeline sources
Branch: master
https://github.com/mongodb/mongo/commit/5c57a8874e277424a3b993b14c04be60d25b6742

Generated at Thu Feb 08 06:26:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.