summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorADAM David Alan Martin <adam.martin@10gen.com>2018-10-01 15:48:22 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2018-10-05 17:49:38 -0400
commit7c26f67b8fd09740b5b55b4f031e3f95fab25fd0 (patch)
tree203819b9ada03a9f07c7c2bb6b21e4108a049365
parent13e13e9ba8a720b0ee95b70c62e59a712af52ac8 (diff)
downloadmongo-7c26f67b8fd09740b5b55b4f031e3f95fab25fd0.tar.gz
SERVER-37393 Fix dtor race in `ReplicaSetMonitorManager`
The members that have been reversed have an ownership-awareness dependency which needs to be honored in order to prevent certain races in shutdown of the `ReplicaSetMonitorManager`. (cherry picked from commit f53b6852add200b7431a77a41e0d10c003706925)
-rw-r--r--src/mongo/client/replica_set_monitor_manager.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mongo/client/replica_set_monitor_manager.h b/src/mongo/client/replica_set_monitor_manager.h
index 2730167668f..731b5122984 100644
--- a/src/mongo/client/replica_set_monitor_manager.h
+++ b/src/mongo/client/replica_set_monitor_manager.h
@@ -98,11 +98,13 @@ private:
// Protects access to the replica set monitors
stdx::mutex _mutex;
- ReplicaSetMonitorsMap _monitors;
// Executor for monitoring replica sets.
std::unique_ptr<executor::TaskExecutor> _taskExecutor;
+ // Needs to be after `_taskExecutor`, so that it will be destroyed before the `_taskExecutor`.
+ ReplicaSetMonitorsMap _monitors;
+
void _setupTaskExecutorInLock(const std::string& name);
// set to true when shutdown has been called.