[SERVER-31262] Storage of _rbidCommandHandle can race with destruction of SyncSourceResolver Created: 26/Sep/17  Updated: 30/Oct/23  Resolved: 13/Oct/17

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 3.4.11, 3.5.13

Type: Bug Priority: Major - P3
Reporter: Spencer Jackson Assignee: Siyuan Zhou
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
is related to SERVER-27499 Race condition in SyncSourceResolver ... Backlog
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.4, v3.2
Sprint: Repl 2017-10-02, Repl 2017-10-23
Participants:
Linked BF Score: 0

 Description   

SyncSourceResolver::join waits for the Resolver's _state member to transition to kComplete. This transition is performed by the final '_finishCallback()' step, performed by the last callback scheduled by SyncSourceResolver. One of callback in the chain, _rbidRequestCallback, schedules a callback, takes a mutex on the SyncSourceResolver, and saves the handle into a member. However, nothing prevents the scheduled callback from executing, calling _finishCallback(), and allowing SyncSourceResolver's deconstructor to finish. If the handle is saved after the destructor calls, its own destructor will never be called, which prevents its shared_ptr's reference count from decrementing, causing a leak.



 Comments   
Comment by Githook User [ 12/Jan/18 ]

Author:

{'email': 'siyuan.zhou@mongodb.com', 'name': 'Siyuan Zhou', 'username': 'visualzhou'}

Message: SERVER-31262 Storage of _rbidCommandHandle can race with destruction of SyncSourceResolver

(cherry picked from commit f6e461f9a2680b48606658c2010ca6f20ee8e8b7)
Branch: v3.4
https://github.com/mongodb/mongo/commit/2676b7aa412853c608c2cd834d53cb3c81aba985

Comment by Githook User [ 13/Oct/17 ]

Author:

{'email': 'siyuan.zhou@mongodb.com', 'name': 'Siyuan Zhou', 'username': 'visualzhou'}

Message: SERVER-31262 Storage of _rbidCommandHandle can race with destruction of SyncSourceResolver
Branch: master
https://github.com/mongodb/mongo/commit/f6e461f9a2680b48606658c2010ca6f20ee8e8b7

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