diff --git a/src/mongo/transport/service_executor_reserved.cpp b/src/mongo/transport/service_executor_reserved.cpp index dd2391cdd47fd..3352eeec5a79a 100644 --- a/src/mongo/transport/service_executor_reserved.cpp +++ b/src/mongo/transport/service_executor_reserved.cpp @@ -131,6 +131,9 @@ Status ServiceExecutorReserved::_startWorker() { if (launchReplacement) { auto threadStartStatus = _startWorker(); if (!threadStartStatus.isOK()) { + lk.lock(); + _numStartingThreads--; + lk.unlock(); LOGV2_WARNING(22981, "Could not start new reserve worker thread", "error"_attr = threadStartStatus);