summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/db.cpp3
-rw-r--r--src/mongo/db/storage/kv/kv_storage_engine_test.cpp8
-rw-r--r--src/mongo/dbtests/framework.cpp5
-rw-r--r--src/mongo/embedded/embedded.cpp2
4 files changed, 12 insertions, 6 deletions
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index f2af3d38ec6..bee6f87d418 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -892,7 +892,8 @@ void shutdownTask() {
// Shut down the global dbclient pool so callers stop waiting for connections.
globalConnPool.shutdown();
- // Shut down the background periodic task runner
+ // Shut down the background periodic task runner. This must be done before shutting down the
+ // storage engine.
if (auto runner = serviceContext->getPeriodicRunner()) {
runner->shutdown();
}
diff --git a/src/mongo/db/storage/kv/kv_storage_engine_test.cpp b/src/mongo/db/storage/kv/kv_storage_engine_test.cpp
index c947ce690e0..0395836eab3 100644
--- a/src/mongo/db/storage/kv/kv_storage_engine_test.cpp
+++ b/src/mongo/db/storage/kv/kv_storage_engine_test.cpp
@@ -410,12 +410,12 @@ public:
}
~TimestampKVEngineTest() {
- _storageEngine->cleanShutdown();
- _storageEngine.reset();
-
- // Shut down the background periodic task runner.
+ // Shut down the background periodic task runner, before the storage engine.
auto runner = getServiceContext()->getPeriodicRunner();
runner->shutdown();
+
+ _storageEngine->cleanShutdown();
+ _storageEngine.reset();
}
std::unique_ptr<KVStorageEngine> _storageEngine;
diff --git a/src/mongo/dbtests/framework.cpp b/src/mongo/dbtests/framework.cpp
index b6e7145814b..9d33e62a60e 100644
--- a/src/mongo/dbtests/framework.cpp
+++ b/src/mongo/dbtests/framework.cpp
@@ -72,6 +72,11 @@ int runDbTests(int argc, char** argv) {
// the memory and makes leak sanitizer happy.
ScriptEngine::dropScopeCache();
+ // Shut down the background periodic task runner, before the storage engine.
+ if (auto runner = getGlobalServiceContext()->getPeriodicRunner()) {
+ runner->shutdown();
+ }
+
// We may be shut down before we have a global storage
// engine.
if (!getGlobalServiceContext()->getStorageEngine())
diff --git a/src/mongo/embedded/embedded.cpp b/src/mongo/embedded/embedded.cpp
index e7e667e05b7..3938c239fb1 100644
--- a/src/mongo/embedded/embedded.cpp
+++ b/src/mongo/embedded/embedded.cpp
@@ -159,7 +159,7 @@ void shutdown(ServiceContext* srvContext) {
LogicalSessionCache::set(serviceContext, nullptr);
- // Shut down the background periodic task runner
+ // Shut down the background periodic task runner, before the storage engine.
if (auto runner = serviceContext->getPeriodicRunner()) {
runner->shutdown();
}