From 6a885430d7e5d6d9084de67793e0560aecc1ce99 Mon Sep 17 00:00:00 2001 From: kssenii Date: Fri, 9 Sep 2022 13:36:23 +0200 Subject: [PATCH] Add assertion --- src/Common/ThreadStatus.cpp | 4 ++++ src/Interpreters/Context.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/Common/ThreadStatus.cpp b/src/Common/ThreadStatus.cpp index b62a7af6c71..2794d12d926 100644 --- a/src/Common/ThreadStatus.cpp +++ b/src/Common/ThreadStatus.cpp @@ -92,6 +92,8 @@ std::vector ThreadGroupStatus ThreadStatus::ThreadStatus() : thread_id{getThreadId()} { + chassert(!current_thread); + last_rusage = std::make_unique(); memory_tracker.setDescription("(for thread)"); @@ -145,6 +147,8 @@ ThreadStatus::ThreadStatus() ThreadStatus::~ThreadStatus() { + chassert(current_thread); + memory_tracker.adjustWithUntrackedMemory(untracked_memory); if (thread_group) diff --git a/src/Interpreters/Context.cpp b/src/Interpreters/Context.cpp index edfa141b0ed..76a29f10b5a 100644 --- a/src/Interpreters/Context.cpp +++ b/src/Interpreters/Context.cpp @@ -323,6 +323,7 @@ struct ContextSharedPart { try { + LOG_DEBUG(log, "Desctructing threadpool reader"); threadpool_reader->wait(); threadpool_reader.reset(); } @@ -336,6 +337,7 @@ struct ContextSharedPart { try { + LOG_DEBUG(log, "Desctructing threadpool writer"); threadpool_writer->wait(); threadpool_writer.reset(); }