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(); }