diff options
| author | Stefan Boberg <[email protected]> | 2023-12-19 10:13:21 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-12-19 10:13:21 +0100 |
| commit | 6aff05d23520dc8883973b9a29aa77b4a4638205 (patch) | |
| tree | f88d6e1da180674962c802f8d42fffb9c17a8b09 /src/zenserver/cache/httpstructuredcache.h | |
| parent | Fix crash bug when trying to inspect non-open block file in GC (#614) (diff) | |
| download | zen-6aff05d23520dc8883973b9a29aa77b4a4638205.tar.xz zen-6aff05d23520dc8883973b9a29aa77b4a4638205.zip | |
cache RPC recorder threading fixes (#617)
* ensure all access to m_Entries is done while holding lock
* RPC recorder concurrency fixes - setup/teardown of recorder needs to be done while holding an exclusive lock. Calls into recorder should be done while holding a shared lock.
Diffstat (limited to 'src/zenserver/cache/httpstructuredcache.h')
| -rw-r--r-- | src/zenserver/cache/httpstructuredcache.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/zenserver/cache/httpstructuredcache.h b/src/zenserver/cache/httpstructuredcache.h index 57a533029..2feaaead8 100644 --- a/src/zenserver/cache/httpstructuredcache.h +++ b/src/zenserver/cache/httpstructuredcache.h @@ -190,6 +190,12 @@ private: void ReplayRequestRecorder(const CacheRequestContext& Context, cache::IRpcRequestReplayer& Replayer, uint32_t ThreadCount); + // This exists to avoid taking locks when recording is not enabled + std::atomic_bool m_RequestRecordingEnabled{false}; + + // This lock should be taken in SHARED mode when calling into the recorder, + // and taken in EXCLUSIVE mode whenever the recorder is created or destroyed + RwLock m_RequestRecordingLock; std::unique_ptr<cache::IRpcRequestRecorder> m_RequestRecorder; }; |