[SERVER-77707] Always invoke onReply callback out-of-line for exhaust commands in NetworkInterfaceTL Created: 01/Jun/23  Updated: 29/Oct/23  Resolved: 07/Jun/23

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

Type: Improvement Priority: Major - P3
Reporter: George Wangensteen Assignee: George Wangensteen
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Problem/Incident
is caused by SERVER-77403 Remove TaskExecutor fulfilling respon... Closed
Related
related to SERVER-77851 Address recursive lock acquisition wh... Closed
is related to SERVER-53084 ServerDiscoveryMonitor::shutdown can ... Closed
Assigned Teams:
Service Arch
Backwards Compatibility: Fully Compatible
Sprint: Service Arch 2023-06-12
Participants:
Linked BF Score: 147

 Description   

In SERVER-53084, we ensured that the onFinish callback that is run whenever an ordinary RPC through the network interface completes (either via success or cancellation/timeout/error) runs out-of-line from the actual completion event. That ensured that code that might complete RPC requests (i.e. by cancelling them) didn't have to worry about holding shared resources that the completion-callbacks might also want to acquire. 

However, for exhaust commands scheduled through the NetworkInterfaceTL, it is still possible for the completion-callback to run in-line with the completion event (i.e. cancellation can invoke the completion callback in-line). This can cause deadlocks when the cancelling code holds resources the callback wants to acquire. We should harden the API to guarantee that the onReply callback for exhaust commands is never run in-line with the completion event, which should simply schedule it. 



 Comments   
Comment by Githook User [ 07/Jun/23 ]

Author:

{'name': 'George Wangensteen', 'email': 'george.wangensteen@mongodb.com', 'username': 'gewa24'}

Message: SERVER-77707 Always invoke onReply callback out-of-line for exhaust commands in NetworkInterfaceTL
Branch: master
https://github.com/mongodb/mongo/commit/896dc42efd5876642309d0e3234bb423257959f7

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