[SERVER-69427] ServiceEntryPointImpl::startSession races Created: 02/Sep/22  Updated: 29/Oct/23  Resolved: 08/Sep/22

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

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

Issue Links:
Depends
is depended on by SERVER-67829 Benchmark for ServiceStateMachine Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

ServiceEntryPointImpl::Sessions contains a SyncToken which is used to safely access Sessions::ByClientMap. ServiceEntryPointImpl::startSession races with other functions that modify the map:

  1. startSession creates a Sessions::iterator.
  2. A code block is started and a SyncToken is created (and therefore _sessions is locked).
  3. A SessionWorkflow is created and inserted, and the iterator is set.
  4. The code block ends, the SyncToken is destroyed, and _sessions is unlocked.
  5. The workflow is started by retrieving from SessionWorkflow from the iterator.

If an operation occurs on _sessions between steps 4. and 5., then the iterator may be invalidated. 



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

Author:

{'name': 'Alex Li', 'email': 'alex.li@mongodb.com', 'username': 'lia394126'}

Message: SERVER-69427 ServiceEntryPointImpl::startSession uses shared pointer instead of Sessions::iterator
Branch: master
https://github.com/mongodb/mongo/commit/ad4a7ae485fd0189542e59b3350e798b42b42d1b

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