[SERVER-48901] Have a client observer destroy ClientOutOfLineExecutor Created: 16/Jun/20  Updated: 29/Oct/23  Resolved: 25/Jun/20

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.4.1, 4.7.0

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

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4
Sprint: Service arch 2020-06-29
Participants:
Linked BF Score: 9

 Description   

ClientOutOfLineExecutor is a decoration on Client, and it manages a MultiProducerSingleConsumerQueue to keep track of scheduled tasks. In its destructor method, ClientOutOfLineExecutor modifies the queue by closing its producer end and executing the scheduled task. The queue internally acquires and releases a lock to allow safe concurrent accesses. When testing diagnostics and tests commands are enabled, the queue would also run LatchAnalyzer methods (e.g., onAcquire) as part of accessing its internal mutex.

Since the destructor is invoked during the destruction of the Client object, and LatchAnalyzer also uses decorators (e.g., LatchSetState) to store Client metadata, running the destructor for ClientOutOfLineExecutor could potentially cause read-after-delete memory accesses.

To fix this issue, we should have an observer run the logic currently implemented by the destructor for ClientOutOfLineExecutor during Client destruction, to prevent the possibility for read-after-delete accesses.



 Comments   
Comment by Githook User [ 18/Aug/20 ]

Author:

{'name': 'Amirsaman Memaripour', 'email': 'amirsaman.memaripour@mongodb.com', 'username': 'samanca'}

Message: SERVER-48901 Have a client observer destroy ClientOutOfLineExecutor

(cherry picked from commit 341fb5d34695cb7d0994f5d91947355d60dabf36)
Branch: v4.4
https://github.com/mongodb/mongo/commit/b32cf077e7516272ffe571560b02618d6fcbdb94

Comment by Githook User [ 25/Jun/20 ]

Author:

{'name': 'Amirsaman Memaripour', 'email': 'amirsaman.memaripour@mongodb.com', 'username': 'samanca'}

Message: SERVER-48901 Have a client observer destroy ClientOutOfLineExecutor
Branch: master
https://github.com/mongodb/mongo/commit/341fb5d34695cb7d0994f5d91947355d60dabf36

Generated at Thu Feb 08 05:18:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.