diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2019-07-24 18:41:18 -0400 |
---|---|---|
committer | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2019-07-24 18:41:18 -0400 |
commit | ca30a67fa011e73e582c43ac88000fed4512a793 (patch) | |
tree | 92cc3771900c70844a1e1d43b8dd76299986ed64 | |
parent | 20ee8f6ac0208f5ba4e77f70b18b2d726782d0f8 (diff) | |
download | mongo-ca30a67fa011e73e582c43ac88000fed4512a793.tar.gz |
SERVER-42374 TimestampMonitor should stop its PeriodicJob prior to destructing itself
-rw-r--r-- | src/mongo/db/storage/storage_engine_impl.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mongo/db/storage/storage_engine_impl.h b/src/mongo/db/storage/storage_engine_impl.h index f934035c162..2236e8444f2 100644 --- a/src/mongo/db/storage/storage_engine_impl.h +++ b/src/mongo/db/storage/storage_engine_impl.h @@ -284,12 +284,16 @@ public: // The set of timestamps that were last reported to the listeners by the monitor. MonitoredTimestamps _currentTimestamps; - // Periodic runner that the timestamp monitor schedules its job on. - PeriodicRunner* _periodicRunner; - // Protects access to _listeners below. stdx::mutex _monitorMutex; std::vector<TimestampListener*> _listeners; + + // Periodic runner that the timestamp monitor schedules its job on. + // This should remain as the last member variable so that its destructor gets executed first + // when the class instance is being deconstructed. This causes the PeriodicJobAnchor to stop + // the PeriodicJob, preventing us from accessing any destructed variables if this were to + // run during the destruction of this class instance. + PeriodicRunner* _periodicRunner; }; StorageEngine* getStorageEngine() override { |