[SERVER-62267] Ensure memory associated with parsed DDL coordinator document is kept alive Created: 24/Dec/21  Updated: 26/Oct/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Tommaso Tocci Assignee: Backlog - Catalog and Routing
Resolution: Unresolved Votes: 0
Labels: oldshardingemea, shardingemea-qw
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Catalog and Routing
Operating System: ALL
Participants:
Story Points: 2

 Description   

I realized that we actually have the same problem for all the classes that extend the ShardingDDLCoordinator.
Many of the classes that extend the ShardingDDLCoordinator  parse their coordinator document at construction time. On the other hand our parsing implementation doesn't take ownership of nested BSONObj if they are not defined as object_owned, so if the coordinator document contains any nested object that is not owned, the parsed coordinator doc stored as a member of the coordinator instance will point to invalid memory.
I find this very error prone, so I was thinking to store a serialized copy of the raw coordinator document in the ShardingDDLCoordinator parent class so that we can ensure that the memory associated with all the fields in the parsed coordinator document will remain alive until the coordinator instance is destructed.


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