|
The following executors are all ThreadPools held as shared_ptrs by PrimaryOnlyService instances. These should be shut down correctly for the reasons described in this comment.
db/s/global_index/global_index_cloning_service.cpp
|
db/s/move_primary/move_primary_donor_service.cpp
|
db/s/move_primary/move_primary_recipient_service.cpp
|
db/s/resharding/resharding_coordinator_service.cpp
|
db/s/resharding/resharding_donor_service.cpp
|
db/s/resharding/resharding_recipient_service.cpp
|
The remaining client/server_discovery_monitor.cpp is a unique case, but should also be shut down correctly. The ThreadPoolTaskExecutor created here is used to initialize _executor, a shared_ptr member. ThreadPoolTaskExecutor should shut itself down properly in its destructor, calling both shutdown and join. This executor will be used to initialize multiple child SingleServerDiscoveryMonitor instances, however these are stored as shared pointers only in a map, which will be destroyed when the ServerDiscoveryMonitor's destructor is called.
The ServerDiscoveryMonitor itself is held by StreamableReplicaSetMonitor, which in turn is created by ReplicaSetMonitorManager, which stores these instances in a map. The ReplicaSetMonitorManager is a decoration on the global ServiceContext.
ReplicaSetMonitorManager is eventually shut down via the ReplicaSetMonitor::shutdown method, which is called as part of process shutdown in mongod and mongos. When shut down, the map containing the child monitors (i.e. ultimately the ServerDiscoveryMonitors) is cleared.
|