summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Shuvalov <andrew.shuvalov@mongodb.com>2021-12-03 14:53:07 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-12-28 21:25:36 +0000
commit169b76c9270e0d6f40d39414dc117be27be4e6af (patch)
tree8dd621ab42f93fccd1f7fbc6aa65b1937d0b42a7
parentc3e7c54097f8634ce92bb03667456fc8b6866577 (diff)
downloadmongo-169b76c9270e0d6f40d39414dc117be27be4e6af.tar.gz
SERVER-61872 Fixed thread pool starvation in FaultManager
-rw-r--r--src/mongo/db/process_health/fault_manager.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mongo/db/process_health/fault_manager.cpp b/src/mongo/db/process_health/fault_manager.cpp
index 9946bf61339..80ec0f13a75 100644
--- a/src/mongo/db/process_health/fault_manager.cpp
+++ b/src/mongo/db/process_health/fault_manager.cpp
@@ -40,11 +40,11 @@
#include "mongo/db/process_health/health_monitoring_gen.h"
#include "mongo/db/process_health/health_observer_registration.h"
#include "mongo/executor/network_interface_factory.h"
-#include "mongo/executor/network_interface_thread_pool.h"
#include "mongo/executor/task_executor.h"
#include "mongo/executor/task_executor_pool.h"
#include "mongo/executor/thread_pool_task_executor.h"
#include "mongo/logv2/log.h"
+#include "mongo/util/concurrency/thread_pool.h"
#include "mongo/util/exit_code.h"
#include "mongo/util/future_util.h"
@@ -54,15 +54,20 @@ namespace process_health {
namespace {
-const auto sFaultManager = ServiceContext::declareDecoration<std::unique_ptr<FaultManager>>();
+static constexpr int kMaxThreadPoolSize = 20;
+const auto sFaultManager = ServiceContext::declareDecoration<std::unique_ptr<FaultManager>>();
ServiceContext::ConstructorActionRegisterer faultManagerRegisterer{
"FaultManagerRegisterer", [](ServiceContext* svcCtx) {
// construct task executor
std::shared_ptr<executor::NetworkInterface> networkInterface =
executor::makeNetworkInterface("FaultManager-TaskExecutor");
- auto pool = std::make_unique<executor::NetworkInterfaceThreadPool>(networkInterface.get());
+ ThreadPool::Options threadPoolOptions;
+ threadPoolOptions.maxThreads = kMaxThreadPoolSize;
+ threadPoolOptions.threadNamePrefix = "FaultManager-";
+ threadPoolOptions.poolName = "FaultManagerThreadPool";
+ auto pool = std::make_unique<ThreadPool>(threadPoolOptions);
auto taskExecutor =
std::make_shared<executor::ThreadPoolTaskExecutor>(std::move(pool), networkInterface);
@@ -187,6 +192,7 @@ FaultManager::~FaultManager() {
void FaultManager::startPeriodicHealthChecks() {
if (!feature_flags::gFeatureFlagHealthMonitoring) {
+ LOGV2_DEBUG(6187201, 1, "Health checks disabled by feature flag");
return;
}