[SERVER-62185] Ensure TenantMigrationRecipentService Fetcher instance survives future completion Created: 20/Dec/21  Updated: 29/Oct/23  Resolved: 23/Dec/21

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

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

Issue Links:
Depends
Related
is related to SERVER-62176 Don't hold the Fetcher::_mutex while ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:
Linked BF Score: 131

 Description   

The TenantMigrationRecipientService creates a Fetcher to retrieve files from the backup cursor used in the shard merge protocol. During shutdown of the PrimaryOnlyService, which means the captured shared pointer to the fetcher will also be destroyed, resulting in the destruction of the fetcher itself. This can result in deadlock during destruction when Fetcher::shutdown is called and tries to acquire the Fetcher mutex, which is already held by a previous Fetcher callback.

The solution here is to ensure that the Fetcher instance survives future completion by making the Fetcher a std::unique_ptr member of the TenantMigrationRecipientService class.



 Comments   
Comment by Githook User [ 22/Dec/21 ]

Author:

{'name': 'Christopher Caplinger', 'email': 'christopher.caplinger@mongodb.com', 'username': 'UnicodeSnowman'}

Message: SERVER-62185: Make backup cursor Fetcher a unique_ptr member
Branch: master
https://github.com/mongodb/mongo/commit/f114b2857bac3830436df4c319fd2cb562a1ff1b

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