[SERVER-40304] Collection cloner can be destroyed with a scope guard active Created: 22/Mar/19  Updated: 29/Oct/23  Resolved: 15/Apr/19

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 4.1.11

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

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Repl 2019-04-22
Participants:
Linked BF Score: 10

 Description   

After the _finishCallback for the CollectionCloner is called, the cloner may be destroyed, so the code must avoid touching method variables after calling it. This is violated by the exit guard for _runQuery, since _runQuery can call _finishCallback.

We should be able to avoid this by creating the onCompletionGuard now created in _runQuery in the lambda function which calls _runQuery, then using it instead of _finishCallback. The _finishCallback can be run in the guard after the current operations run in ON_BLOCK_EXIT, and the ON_BLOCK_EXIT can be removed.



 Comments   
Comment by Githook User [ 15/Apr/19 ]

Author:

{'email': 'matthew.russotto@10gen.com', 'name': 'Matthew Russotto', 'username': 'mtrussotto'}

Message: SERVER-40304 Collection cloner can be destroyed with a scope guard active
Branch: master
https://github.com/mongodb/mongo/commit/264c6248f8a25bf881e20332bc16904a4e5d5544

Generated at Thu Feb 08 04:54:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.