[SERVER-58456] Avoid resetting `ServiceContext` members in `mongo_embedded_test` Created: 12/Jul/21  Updated: 17/Sep/21  Resolved: 17/Sep/21

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

Type: Bug Priority: Major - P3
Reporter: Amirsaman Memaripour Assignee: Amirsaman Memaripour
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Gantt Dependency
has to be done before SERVER-51055 ServiceContext getters/setters are ra... Open
Operating System: ALL
Participants:

 Description   

SERVER-51055 aims to ensure setting/getting ServiceContext members (e.g., _fastClockSource) is thread-safe. Resetting a member after reading it, however, violates this guarantee and is not a safe practice. This behavior, even in the context of a single-threaded program, could introduce memory corruptions as an earlier reference to the member (e.g., acquired through getFastClockSource) will be invalidated by resetting the member (e.g., setFastClockSource).

This ticket should analyze mongo_embedded_test and fix any set-after-get for ServiceContext members (e.g., here).



 Comments   
Comment by Amirsaman Memaripour [ 17/Sep/21 ]

This fix won't be necessary after SERVER-59157 and synchronizing ServiceContext getter/setter methods.

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