From a073cd6c791ed86f56ab9a3abf0dbf0ad4c02a5d Mon Sep 17 00:00:00 2001 From: tavplubix Date: Sat, 2 May 2020 19:54:20 +0300 Subject: [PATCH] Fix segfault in StorageBuffer when exception on server startup (#10609) * fix segfault in StorageBuffer when exception on server startup * Trigger CI Co-authored-by: alexey-milovidov --- src/Core/BackgroundSchedulePool.h | 2 ++ src/Storages/StorageBuffer.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/Core/BackgroundSchedulePool.h b/src/Core/BackgroundSchedulePool.h index 65e163a5320..8e9dc89abde 100644 --- a/src/Core/BackgroundSchedulePool.h +++ b/src/Core/BackgroundSchedulePool.h @@ -161,6 +161,8 @@ public: task_info->deactivate(); } + operator bool() const { return task_info != nullptr; } + BackgroundSchedulePoolTaskInfo * operator->() { return task_info.get(); } const BackgroundSchedulePoolTaskInfo * operator->() const { return task_info.get(); } diff --git a/src/Storages/StorageBuffer.cpp b/src/Storages/StorageBuffer.cpp index 6b51f64c25e..38468413e49 100644 --- a/src/Storages/StorageBuffer.cpp +++ b/src/Storages/StorageBuffer.cpp @@ -468,6 +468,9 @@ void StorageBuffer::startup() void StorageBuffer::shutdown() { + if (!flush_handle) + return; + flush_handle->deactivate(); try