[SERVER-74881] Delist opCtx if sessionWorkFlow errors between dispatchWork() and acceptResponse() Created: 15/Mar/23  Updated: 29/Oct/23  Resolved: 10/Apr/23

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

Type: Bug Priority: Major - P3
Reporter: Jason Chan Assignee: Jason Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Assigned Teams:
Service Arch
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Service Arch 2023-04-17
Participants:
Linked BF Score: 18

 Description   

There is currently a race with shutdown in SessionWorkflow::_scheduleIteration().

As part of _doOneIteration(), the opCtx for each scheduled workItem is created as part of dispatchWork(), and the opCtx is expected to be destroyed as part of acceptResponse(), which is called in a continuation of the above dispatchWork() call.

However, it's possible that we shutdown after calling dispatchWork() and before acceptResponse(), which means we enter cleanupSession() before delisting the opCtx. As part of cleanup, we eventually enter killExhaust() which will create a new opCtx to issue the killCursors command. This causes a tassert to fire since we would be trying to create a new opCtx while one is already registered.



 Comments   
Comment by Githook User [ 10/Apr/23 ]

Author:

{'name': 'Jason Chan', 'email': 'jason.chan@mongodb.com', 'username': 'jasonjhchan'}

Message: SERVER-74881 Delist opCtx if sessionWorkFlow errors between dispatchWork() and acceptResponse()
Branch: master
https://github.com/mongodb/mongo/commit/58d75f474fafa037a154dfff18185da4f26dbf91

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