[SERVER-70502] Prevent data race in `NetworkInterfaceMock::NetworkOperation` Created: 12/Oct/22  Updated: 29/Oct/23  Resolved: 14/Oct/22

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

Type: Bug Priority: Major - P3
Reporter: Reo Kimura (Inactive) Assignee: Reo Kimura (Inactive)
Resolution: Fixed Votes: 0
Labels: tsan
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Service Arch 2022-10-17
Participants:
Linked BF Score: 15

 Description   

NetworkInterfaceMock can receive multiple responses for a particular request, though only the first to be processed is used while any others are disregarded. This is handled by checking whether a NetworkOperation has been marked as finished, and doing so if not. Response processing can only be done by a thread simulating the network.

It is possible for another thread to issue a cancellation response for a particular request and cause a data race when checking whether the operation the response is for has already finished, while the network thread is processing the first response received for the same request.

Since any responses processed for a request besides the first are disregarded, the problematic read that checks if an operation has finished in order to determine whether or not to send a cancellation response is superfluous, and should be removed.



 Comments   
Comment by Githook User [ 13/Oct/22 ]

Author:

{'name': 'Reo Kimura', 'email': 'reo.kimura@mongodb.com', 'username': 'rkimura21'}

Message: SERVER-70502 Prevent data race in `NetworkInterfaceMock::NetworkOperation`
Branch: master
https://github.com/mongodb/mongo/commit/f4eaf82b3fe424e771596ec2b4638fe50a434bb7

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