summaryrefslogtreecommitdiff
path: root/src/mongo/db/mongod_main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/mongod_main.cpp')
-rw-r--r--src/mongo/db/mongod_main.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/mongo/db/mongod_main.cpp b/src/mongo/db/mongod_main.cpp
index 8e69eea713a..8d107a27e54 100644
--- a/src/mongo/db/mongod_main.cpp
+++ b/src/mongo/db/mongod_main.cpp
@@ -723,7 +723,16 @@ ExitCode _initAndListen(ServiceContext* serviceContext, int listenPort) {
// operation context anymore
startupOpCtx.reset();
- auto start = serviceContext->getServiceEntryPoint()->start();
+ auto start = serviceContext->getServiceExecutor()->start();
+ if (!start.isOK()) {
+ LOGV2_ERROR(20570,
+ "Error starting service executor: {error}",
+ "Error starting service executor",
+ "error"_attr = start);
+ return EXIT_NET_ERROR;
+ }
+
+ start = serviceContext->getServiceEntryPoint()->start();
if (!start.isOK()) {
LOGV2_ERROR(20571,
"Error starting service entry point: {error}",
@@ -1260,6 +1269,11 @@ void shutdownTask(const ShutdownTaskArgs& shutdownArgs) {
CatalogCacheLoader::get(serviceContext).shutDown();
}
+#if __has_feature(address_sanitizer)
+ // When running under address sanitizer, we get false positive leaks due to disorder around
+ // the lifecycle of a connection and request. When we are running under ASAN, we try a lot
+ // harder to dry up the server from active connections before going on to really shut down.
+
// Shutdown the Service Entry Point and its sessions and give it a grace period to complete.
if (auto sep = serviceContext->getServiceEntryPoint()) {
LOGV2_OPTIONS(4784923, {LogComponent::kCommand}, "Shutting down the ServiceEntryPoint");
@@ -1270,6 +1284,19 @@ void shutdownTask(const ShutdownTaskArgs& shutdownArgs) {
}
}
+ // Shutdown and wait for the service executor to exit
+ if (auto svcExec = serviceContext->getServiceExecutor()) {
+ LOGV2_OPTIONS(4784924, {LogComponent::kExecutor}, "Shutting down the service executor");
+ Status status = svcExec->shutdown(Seconds(10));
+ if (!status.isOK()) {
+ LOGV2_OPTIONS(20564,
+ {LogComponent::kNetwork},
+ "Service executor did not shutdown within the time limit",
+ "error"_attr = status);
+ }
+ }
+#endif
+
LOGV2(4784925, "Shutting down free monitoring");
stopFreeMonitoring();