[SERVER-69702] TaskExecutorCursor can fail to populate _rcr with updated opCtx if multiple cursors returned Created: 14/Sep/22  Updated: 29/Oct/23  Resolved: 16/Sep/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.2.0-rc0

Type: Task Priority: Major - P3
Reporter: George Wangensteen Assignee: George Wangensteen
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Service Arch 2022-09-19, Service Arch 2022-10-03
Participants:

 Description   

TaskExecutorCursor can issue queries that the remote can respond to with multiple cursors. In such cases, we use the TaskExecutorCursor that issued the query to handle the first cursor, and create new TaskExecutorCursors for each additional cursor in the response using this constructor here . 

We rely on our processing of the first cursor to update the _rcr we pass into the constructor with the 'new' opCtx https://github.com/mongodb/mongo/blob/790dde10c5f653c65b394cf397e96d099e2f5d03/src/mongo/executor/task_executor_cursor.cpp#L162 - but if the first cursor id is 0 / there is no more additional data in it, we'll skip doing that population here https://github.com/mongodb/mongo/blob/790dde10c5f653c65b394cf397e96d099e2f5d03/src/mongo/executor/task_executor_cursor.cpp#L210. As a result, the _rcr we pass to construct the additional TECs can have a 'stale' opCtx in it - the one that was originally used to issue the first query - which may be destroyed when these constructors are called.



 Comments   
Comment by Githook User [ 16/Sep/22 ]

Author:

{'name': 'George Wangensteen', 'email': 'george.wangensteen@mongodb.com', 'username': 'gewa24'}

Message: SERVER-69702 Ensure TaskExecutorCursor's constructed from multi-cursor replies have correct OperationContext
Branch: master
https://github.com/mongodb/mongo/commit/228a21b45bbe9978c80059538d2136afd337fed8

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