[SERVER-66907] Follow up work for SERVER-63789 Created: 31/May/22  Updated: 29/Oct/23  Resolved: 06/Sep/22

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

Type: Task Priority: Major - P3
Reporter: Suganthi Mani Assignee: Christopher Caplinger
Resolution: Fixed Votes: 0
Labels: shard-merge-milestone-1
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-63789 Don't block recipient oplog applicati... Closed
Backwards Compatibility: Fully Compatible
Sprint: Server Serverless 2022-06-13, Server Serverless 2022-06-27, Server Serverless 2022-07-11, Server Serverless 2022-07-25, Server Serverless 2022-08-08, Server Serverless 2022-08-22, Server Serverless 2022-09-05
Participants:

 Description   

2 followup works:
1) Currently, we call thread join() within the mutex lock which can cause deadlocks (_thread waiting for the mutex lock, and reset() thread takes the mutex lock and wait for the _thread to join). We should modify the code such that all thread joins happen outside of the mutex lock.

2) Currently opCtx interruption logic in the tenantFileImporter Service is broken.  We need a reliable way for the interrupt thread to interrupt the spawned thread's opCtx.



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

Author:

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

Message: SERVER-66907: Handle opCtx interruption and join threads outside mutex
Branch: master
https://github.com/mongodb/mongo/commit/4dcbde61f72b8a87df2dc21023d68b6f5a9c20c3

Comment by Suganthi Mani [ 23/Aug/22 ]

CC christopher.caplinger@mongodb.com  

Work item #2 

Spoke with Sam (from Service Arch team)  and decided to implement the below solution as the short-term solution.

     _thread = std::make_unique<stdx::thread>([this] {
       Client::initThread("TenantFileImporter");
        auto opCtx = CC()->makeOperationContext();
         ON_BLOCK_EXIT([&] {
            stdx::lock_guard lk(_mutex);
            // De-register opCtx with the TenantFileImporterService
                _opCtx = nullptr;
         });
 
        {
            // Register opCtx with the TenantFileImporterService if the state is not interrupted
            stdx::lock_guard lk(_mutex);
            _opCtx = opCtx.get();
        }
        _handleEvents(opCtx.get());
    });

Once the above fix goes in, we can uncomment this piece of opCtx interruption code.

Comment by Christopher Caplinger [ 02/Aug/22 ]

suganthi.mani@mongodb.com is there a comment/description/etc. somewhere that describes what this ticket entails? I don't recall specifically what the follow-up work is here.

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