Skip to content

Commit b17ab8f

Browse files
Fix crash during compaction on closed DiskCache (#1196)
If DiskCache has been closed already but compaction is called explicitly the SIGSEGV would occur Relates-To: OAM-1016 Signed-off-by: Andrey Kashcheev <[email protected]>
1 parent 8c7360b commit b17ab8f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

olp-cpp-sdk-core/src/cache/DiskCache.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ bool DiskCache::Clear() {
151151
void DiskCache::Compact() {
152152
// Lets make sure that the parallel thread which is running the compact is not
153153
// doing it already. We don't need two at the same time.
154-
if (!compacting_.exchange(true)) {
154+
if (database_ && !compacting_.exchange(true)) {
155155
OLP_SDK_LOG_INFO(kLogTag, "Compact: Compacting database started");
156156
database_->CompactRange(nullptr, nullptr);
157157
compacting_ = false;

0 commit comments

Comments
 (0)