summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Midvidy <amidvidy@gmail.com>2016-03-04 13:41:39 -0500
committerAdam Midvidy <amidvidy@gmail.com>2016-03-11 14:02:19 -0500
commit9629104644ffd55b3e556f0a7f60a1b45b3198be (patch)
treee8edc8e64546da480e763d132f047a2ec44c54b6
parent8d7edf717cd3112e7487361050e882f6902418d5 (diff)
downloadmongo-9629104644ffd55b3e556f0a7f60a1b45b3198be.tar.gz
SERVER-22967 ensure UserCacheInvalidator stops before we destroy its state
(cherry picked from commit 703c1f823eea9df285ed0fd2d167730664490286)
-rw-r--r--src/mongo/db/auth/user_cache_invalidator_job.cpp6
-rw-r--r--src/mongo/db/auth/user_cache_invalidator_job.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/db/auth/user_cache_invalidator_job.cpp b/src/mongo/db/auth/user_cache_invalidator_job.cpp
index a62b69370e2..9d8bf0ad3ca 100644
--- a/src/mongo/db/auth/user_cache_invalidator_job.cpp
+++ b/src/mongo/db/auth/user_cache_invalidator_job.cpp
@@ -110,6 +110,12 @@ StatusWith<OID> getCurrentCacheGeneration(OperationContext* txn) {
UserCacheInvalidator::UserCacheInvalidator(AuthorizationManager* authzManager)
: _authzManager(authzManager) {}
+UserCacheInvalidator::~UserCacheInvalidator() {
+ invariant(inShutdown());
+ // Wait to stop running.
+ wait();
+}
+
void UserCacheInvalidator::initialize(OperationContext* txn) {
StatusWith<OID> currentGeneration = getCurrentCacheGeneration(txn);
if (currentGeneration.isOK()) {
diff --git a/src/mongo/db/auth/user_cache_invalidator_job.h b/src/mongo/db/auth/user_cache_invalidator_job.h
index 3b1c2544939..e32c7f662a3 100644
--- a/src/mongo/db/auth/user_cache_invalidator_job.h
+++ b/src/mongo/db/auth/user_cache_invalidator_job.h
@@ -44,6 +44,7 @@ class OperationContext;
class UserCacheInvalidator : public BackgroundJob {
public:
UserCacheInvalidator(AuthorizationManager* authzManager);
+ ~UserCacheInvalidator();
void initialize(OperationContext* txn);