summaryrefslogtreecommitdiff
path: root/src/mongo/db/mongod_main.cpp
diff options
context:
space:
mode:
authorBen Caimano <ben.caimano@10gen.com>2020-09-11 20:09:59 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-09-14 04:57:01 +0000
commit827a25eb01bc5ddf766b3a543ef0ba5112953e1b (patch)
tree504935db5b1292818dcd9b862bf8b5c3b4352fb5 /src/mongo/db/mongod_main.cpp
parentbd320bc2d10cff75756a2c95986cc81ec8a5e7c7 (diff)
downloadmongo-827a25eb01bc5ddf766b3a543ef0ba5112953e1b.tar.gz
SERVER-50867 Roll back ServiceStateMachine changes temporarily
This reverts these commits: b039b24746e1d1fb10a32e1ca4831423c01d4cd7: SERVER-48980 97e16187ff3065d242a61a52e7b6edd4d439fb30: SERVER-49072 0607a6c291bf4cf4580a4444d826ed3c3ac3df47: SERVER-49104
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();