[SERVER-48687] ReplicationCoordinatorMock is not thread safe and causes errors with tsan Created: 10/Jun/20  Updated: 29/Oct/23  Resolved: 18/Jun/20

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

Type: Bug Priority: Major - P3
Reporter: Marcos José Grillo Ramirez Assignee: Marcos José Grillo Ramirez
Resolution: Fixed Votes: 0
Labels: thread-sanitizer
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-48734 Fix db_repl_test in TSAN Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding 2020-06-15, Sharding 2020-06-29
Participants:
Linked BF Score: 0

 Description   

tsan is a data race detection tool that detects write/read races. When running db_s_collection_sharding_runtime_test binary, the ReplicationCoordinatorMock class reads and writes _myLastAppliedOpTime and _myLastAppliedWallTime without any synchronization mechanism, which causes this race.



 Comments   
Comment by Githook User [ 18/Jun/20 ]

Author:

{'name': 'Marcos José Grillo Ramírez', 'email': 'marcos.grillo@mongodb.com', 'username': 'm4nti5'}

Message: SERVER-48687 Added mutex to coordinator mock to prevent tsan errors that are not actually logical problems but benign data races
Branch: master
https://github.com/mongodb/mongo/commit/afb48b7c57718194bd7da1f93b5c4646cac819a0

Comment by Andrew Morrow (Inactive) [ 11/Jun/20 ]

There are multiple TSAN unit tests that are failing because of this. Fixing it would move us much closer to a green unit test run with TSAN.

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