From 4809b5975a16efd36f3678446b59d31e35c39fd1 Mon Sep 17 00:00:00 2001 From: Amos Bird Date: Mon, 30 Nov 2020 16:53:07 +0800 Subject: [PATCH 01/14] Fix system.stack_trace in daemon --- src/Storages/System/StorageSystemStackTrace.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Storages/System/StorageSystemStackTrace.cpp b/src/Storages/System/StorageSystemStackTrace.cpp index 9edcb1ede47..e822ac26744 100644 --- a/src/Storages/System/StorageSystemStackTrace.cpp +++ b/src/Storages/System/StorageSystemStackTrace.cpp @@ -33,7 +33,8 @@ namespace ErrorCodes namespace { - const pid_t expected_pid = getpid(); + // Initialized in StorageSystemStackTrace's ctor and used in signalHandler. + pid_t expected_pid; const int sig = SIGRTMIN; std::atomic sequence_num = 0; /// For messages sent via pipe. @@ -133,6 +134,7 @@ StorageSystemStackTrace::StorageSystemStackTrace(const StorageID & table_id_) /// Setup signal handler. + expected_pid = getpid(); struct sigaction sa{}; sa.sa_sigaction = signalHandler; sa.sa_flags = SA_SIGINFO; @@ -214,7 +216,11 @@ void StorageSystemStackTrace::fillData(MutableColumns & res_columns, const Conte res_columns[2]->insertDefault(); } - ++sequence_num; /// FYI: For signed Integral types, arithmetic is defined to use two’s complement representation. There are no undefined results. + /// Signed integer overflow is undefined behavior in both C and C++. However, according to + /// C++ standard, Atomic signed integer arithmetic is defined to use two's complement; there + /// are no undefined results. See https://en.cppreference.com/w/cpp/atomic/atomic and + /// http://eel.is/c++draft/atomics.types.generic#atomics.types.int-8 + ++sequence_num; } } From a0f4dfd94816603db22324edce631f72caa0d249 Mon Sep 17 00:00:00 2001 From: Amos Bird Date: Mon, 30 Nov 2020 21:53:04 +0800 Subject: [PATCH 02/14] get back tests --- tests/queries/0_stateless/01051_system_stack_trace.reference | 1 + tests/queries/0_stateless/01051_system_stack_trace.sql | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 tests/queries/0_stateless/01051_system_stack_trace.reference create mode 100644 tests/queries/0_stateless/01051_system_stack_trace.sql diff --git a/tests/queries/0_stateless/01051_system_stack_trace.reference b/tests/queries/0_stateless/01051_system_stack_trace.reference new file mode 100644 index 00000000000..d00491fd7e5 --- /dev/null +++ b/tests/queries/0_stateless/01051_system_stack_trace.reference @@ -0,0 +1 @@ +1 diff --git a/tests/queries/0_stateless/01051_system_stack_trace.sql b/tests/queries/0_stateless/01051_system_stack_trace.sql new file mode 100644 index 00000000000..32d344fce7e --- /dev/null +++ b/tests/queries/0_stateless/01051_system_stack_trace.sql @@ -0,0 +1,2 @@ +-- at least this query should be present +SELECT count() > 0 FROM system.stack_trace WHERE query_id != ''; From d0044886ab1b41f30cd8ec9255411897f625ecac Mon Sep 17 00:00:00 2001 From: Amos Bird Date: Tue, 1 Dec 2020 11:45:10 +0800 Subject: [PATCH 03/14] fix TSan --- src/Storages/System/StorageSystemStackTrace.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Storages/System/StorageSystemStackTrace.cpp b/src/Storages/System/StorageSystemStackTrace.cpp index e822ac26744..a72fbeb2d5d 100644 --- a/src/Storages/System/StorageSystemStackTrace.cpp +++ b/src/Storages/System/StorageSystemStackTrace.cpp @@ -34,7 +34,7 @@ namespace ErrorCodes namespace { // Initialized in StorageSystemStackTrace's ctor and used in signalHandler. - pid_t expected_pid; + std::atomic expected_pid; const int sig = SIGRTMIN; std::atomic sequence_num = 0; /// For messages sent via pipe. From c4306b5788a8f4b327e5c73cc3a0e397f8afeb4d Mon Sep 17 00:00:00 2001 From: Amos Bird Date: Tue, 1 Dec 2020 16:37:30 +0800 Subject: [PATCH 04/14] Another try of TSan fix --- src/Storages/System/StorageSystemStackTrace.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Storages/System/StorageSystemStackTrace.cpp b/src/Storages/System/StorageSystemStackTrace.cpp index a72fbeb2d5d..ef4bf023933 100644 --- a/src/Storages/System/StorageSystemStackTrace.cpp +++ b/src/Storages/System/StorageSystemStackTrace.cpp @@ -34,7 +34,6 @@ namespace ErrorCodes namespace { // Initialized in StorageSystemStackTrace's ctor and used in signalHandler. - std::atomic expected_pid; const int sig = SIGRTMIN; std::atomic sequence_num = 0; /// For messages sent via pipe. @@ -49,6 +48,8 @@ namespace void signalHandler(int, siginfo_t * info, void * context) { + // getpid() is an async-signal-safe function required by POSIX.1 + static const pid_t expected_pid = getpid(); auto saved_errno = errno; /// We must restore previous value of errno in signal handler. /// In case malicious user is sending signals manually (for unknown reason). @@ -133,8 +134,6 @@ StorageSystemStackTrace::StorageSystemStackTrace(const StorageID & table_id_) notification_pipe.open(); /// Setup signal handler. - - expected_pid = getpid(); struct sigaction sa{}; sa.sa_sigaction = signalHandler; sa.sa_flags = SA_SIGINFO; From 5e71f4e810a7005f489f6a2cb6a4df509ad2eca1 Mon Sep 17 00:00:00 2001 From: Amos Bird Date: Tue, 1 Dec 2020 20:33:42 +0800 Subject: [PATCH 05/14] Have to resort to NO_SANITIZE_THREAD --- src/Storages/System/StorageSystemStackTrace.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Storages/System/StorageSystemStackTrace.cpp b/src/Storages/System/StorageSystemStackTrace.cpp index ef4bf023933..4f2ade17900 100644 --- a/src/Storages/System/StorageSystemStackTrace.cpp +++ b/src/Storages/System/StorageSystemStackTrace.cpp @@ -34,6 +34,7 @@ namespace ErrorCodes namespace { // Initialized in StorageSystemStackTrace's ctor and used in signalHandler. + std::atomic expected_pid; const int sig = SIGRTMIN; std::atomic sequence_num = 0; /// For messages sent via pipe. @@ -46,10 +47,9 @@ namespace LazyPipeFDs notification_pipe; - void signalHandler(int, siginfo_t * info, void * context) + // TSan complains about expected_pid being accessed unsafely, which is not the case. + void NO_SANITIZE_THREAD signalHandler(int, siginfo_t * info, void * context) { - // getpid() is an async-signal-safe function required by POSIX.1 - static const pid_t expected_pid = getpid(); auto saved_errno = errno; /// We must restore previous value of errno in signal handler. /// In case malicious user is sending signals manually (for unknown reason). @@ -134,6 +134,7 @@ StorageSystemStackTrace::StorageSystemStackTrace(const StorageID & table_id_) notification_pipe.open(); /// Setup signal handler. + expected_pid = getpid(); struct sigaction sa{}; sa.sa_sigaction = signalHandler; sa.sa_flags = SA_SIGINFO; From b513eeee7f2ea5148b16118ffe9bb9030109a940 Mon Sep 17 00:00:00 2001 From: alexey-milovidov Date: Tue, 1 Dec 2020 22:20:02 +0300 Subject: [PATCH 06/14] Another try... --- src/Storages/System/StorageSystemStackTrace.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Storages/System/StorageSystemStackTrace.cpp b/src/Storages/System/StorageSystemStackTrace.cpp index 4f2ade17900..954318fa7ac 100644 --- a/src/Storages/System/StorageSystemStackTrace.cpp +++ b/src/Storages/System/StorageSystemStackTrace.cpp @@ -161,7 +161,7 @@ NamesAndTypesList StorageSystemStackTrace::getNamesAndTypes() } -void StorageSystemStackTrace::fillData(MutableColumns & res_columns, const Context &, const SelectQueryInfo &) const +void NO_SANITIZE_THREAD StorageSystemStackTrace::fillData(MutableColumns & res_columns, const Context &, const SelectQueryInfo &) const { /// It shouldn't be possible to do concurrent reads from this table. std::lock_guard lock(mutex); From cfeaff6aa7ac7f1ac94e9166e60aba8b14d8b1b5 Mon Sep 17 00:00:00 2001 From: alexey-milovidov Date: Tue, 1 Dec 2020 22:20:49 +0300 Subject: [PATCH 07/14] Update StorageSystemStackTrace.cpp --- src/Storages/System/StorageSystemStackTrace.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Storages/System/StorageSystemStackTrace.cpp b/src/Storages/System/StorageSystemStackTrace.cpp index 954318fa7ac..6b6612e611b 100644 --- a/src/Storages/System/StorageSystemStackTrace.cpp +++ b/src/Storages/System/StorageSystemStackTrace.cpp @@ -47,7 +47,7 @@ namespace LazyPipeFDs notification_pipe; - // TSan complains about expected_pid being accessed unsafely, which is not the case. + // TSan complains about stack_trace being accessed unsafely, which is not the case. void NO_SANITIZE_THREAD signalHandler(int, siginfo_t * info, void * context) { auto saved_errno = errno; /// We must restore previous value of errno in signal handler. From 0aa75e6023577c10eb73cb41afaf120cb44bf66a Mon Sep 17 00:00:00 2001 From: Amos Bird Date: Tue, 8 Dec 2020 01:48:41 +0800 Subject: [PATCH 08/14] Another try of TSan fix --- src/Storages/System/CMakeLists.txt | 2 ++ src/Storages/System/StorageSystemStackTrace.cpp | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Storages/System/CMakeLists.txt b/src/Storages/System/CMakeLists.txt index a1eb525dceb..f6d443b9aa3 100644 --- a/src/Storages/System/CMakeLists.txt +++ b/src/Storages/System/CMakeLists.txt @@ -15,6 +15,8 @@ include(${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake) add_headers_and_sources(storages_system .) list (APPEND storages_system_sources ${CONFIG_BUILD}) +set_source_files_properties(StorageSystemStackTrace.cpp PROPERTIES COMPILE_FLAGS -fno-sanitize=thread) + add_custom_target(generate-contributors ./StorageSystemContributors.sh SOURCES StorageSystemContributors.sh diff --git a/src/Storages/System/StorageSystemStackTrace.cpp b/src/Storages/System/StorageSystemStackTrace.cpp index 6b6612e611b..5cfad1f5bdc 100644 --- a/src/Storages/System/StorageSystemStackTrace.cpp +++ b/src/Storages/System/StorageSystemStackTrace.cpp @@ -47,8 +47,7 @@ namespace LazyPipeFDs notification_pipe; - // TSan complains about stack_trace being accessed unsafely, which is not the case. - void NO_SANITIZE_THREAD signalHandler(int, siginfo_t * info, void * context) + void signalHandler(int, siginfo_t * info, void * context) { auto saved_errno = errno; /// We must restore previous value of errno in signal handler. @@ -161,7 +160,7 @@ NamesAndTypesList StorageSystemStackTrace::getNamesAndTypes() } -void NO_SANITIZE_THREAD StorageSystemStackTrace::fillData(MutableColumns & res_columns, const Context &, const SelectQueryInfo &) const +void StorageSystemStackTrace::fillData(MutableColumns & res_columns, const Context &, const SelectQueryInfo &) const { /// It shouldn't be possible to do concurrent reads from this table. std::lock_guard lock(mutex); From 04128c33e1f99730935edcf2ef1e766dd916e29d Mon Sep 17 00:00:00 2001 From: Amos Bird Date: Sat, 12 Dec 2020 14:17:48 +0800 Subject: [PATCH 09/14] disable TSAN for real --- src/Storages/System/CMakeLists.txt | 2 -- src/Storages/System/StorageSystemStackTrace.cpp | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Storages/System/CMakeLists.txt b/src/Storages/System/CMakeLists.txt index f6d443b9aa3..a1eb525dceb 100644 --- a/src/Storages/System/CMakeLists.txt +++ b/src/Storages/System/CMakeLists.txt @@ -15,8 +15,6 @@ include(${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake) add_headers_and_sources(storages_system .) list (APPEND storages_system_sources ${CONFIG_BUILD}) -set_source_files_properties(StorageSystemStackTrace.cpp PROPERTIES COMPILE_FLAGS -fno-sanitize=thread) - add_custom_target(generate-contributors ./StorageSystemContributors.sh SOURCES StorageSystemContributors.sh diff --git a/src/Storages/System/StorageSystemStackTrace.cpp b/src/Storages/System/StorageSystemStackTrace.cpp index 5cfad1f5bdc..92d12c19986 100644 --- a/src/Storages/System/StorageSystemStackTrace.cpp +++ b/src/Storages/System/StorageSystemStackTrace.cpp @@ -47,7 +47,7 @@ namespace LazyPipeFDs notification_pipe; - void signalHandler(int, siginfo_t * info, void * context) + void NO_SANITIZE_THREAD signalHandler(int, siginfo_t * info, void * context) { auto saved_errno = errno; /// We must restore previous value of errno in signal handler. @@ -79,7 +79,7 @@ namespace } /// Wait for data in pipe and read it. - bool wait(int timeout_ms) + bool NO_SANITIZE_THREAD wait(int timeout_ms) { while (true) { @@ -127,7 +127,7 @@ namespace } -StorageSystemStackTrace::StorageSystemStackTrace(const StorageID & table_id_) +NO_SANITIZE_THREAD StorageSystemStackTrace::StorageSystemStackTrace(const StorageID & table_id_) : IStorageSystemOneBlock(table_id_) { notification_pipe.open(); @@ -160,7 +160,7 @@ NamesAndTypesList StorageSystemStackTrace::getNamesAndTypes() } -void StorageSystemStackTrace::fillData(MutableColumns & res_columns, const Context &, const SelectQueryInfo &) const +void NO_SANITIZE_THREAD StorageSystemStackTrace::fillData(MutableColumns & res_columns, const Context &, const SelectQueryInfo &) const { /// It shouldn't be possible to do concurrent reads from this table. std::lock_guard lock(mutex); From 0d4b0410958a5aeb7c1de4194266989d8ed63662 Mon Sep 17 00:00:00 2001 From: Amos Bird Date: Sat, 12 Dec 2020 21:03:41 +0800 Subject: [PATCH 10/14] try harder --- src/Common/StackTrace.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Common/StackTrace.cpp b/src/Common/StackTrace.cpp index b285a45bdc5..38a2235d516 100644 --- a/src/Common/StackTrace.cpp +++ b/src/Common/StackTrace.cpp @@ -252,12 +252,12 @@ void StackTrace::symbolize(const StackTrace::FramePointers & frame_pointers, siz #endif } -StackTrace::StackTrace() +NO_SANITIZE_THREAD StackTrace::StackTrace() { tryCapture(); } -StackTrace::StackTrace(const ucontext_t & signal_context) +NO_SANITIZE_THREAD StackTrace::StackTrace(const ucontext_t & signal_context) { tryCapture(); @@ -295,17 +295,17 @@ void StackTrace::tryCapture() #endif } -size_t StackTrace::getSize() const +size_t NO_SANITIZE_THREAD StackTrace::getSize() const { return size; } -size_t StackTrace::getOffset() const +size_t NO_SANITIZE_THREAD StackTrace::getOffset() const { return offset; } -const StackTrace::FramePointers & StackTrace::getFramePointers() const +const NO_SANITIZE_THREAD StackTrace::FramePointers & StackTrace::getFramePointers() const { return frame_pointers; } From 7ca86f176c1587a1129bb3833aa6db3de7964e06 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Wed, 16 Dec 2020 01:43:07 +0300 Subject: [PATCH 11/14] Fix TSan warning in system.stack_trace --- .../System/StorageSystemStackTrace.cpp | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/src/Storages/System/StorageSystemStackTrace.cpp b/src/Storages/System/StorageSystemStackTrace.cpp index 92d12c19986..dd21495ed4b 100644 --- a/src/Storages/System/StorageSystemStackTrace.cpp +++ b/src/Storages/System/StorageSystemStackTrace.cpp @@ -38,8 +38,18 @@ namespace const int sig = SIGRTMIN; std::atomic sequence_num = 0; /// For messages sent via pipe. + std::atomic data_ready_num = 0; - std::optional stack_trace; + /** Notes: + * Only one query from the table can be processed at the moment of time. + * This is ensured by the mutex in fillData function. + * We obtain information about threads by sending signal and receiving info from the signal handler. + * Information is passed via global variables and pipe is used for signaling. + * Actually we can send all information via pipe, but we read from it with timeout just in case, + * so it's convenient to use is only for signaling. + */ + + StackTrace stack_trace{NoCapture{}}; constexpr size_t max_query_id_size = 128; char query_id_data[max_query_id_size]; @@ -47,7 +57,7 @@ namespace LazyPipeFDs notification_pipe; - void NO_SANITIZE_THREAD signalHandler(int, siginfo_t * info, void * context) + void signalHandler(int, siginfo_t * info, void * context) { auto saved_errno = errno; /// We must restore previous value of errno in signal handler. @@ -57,19 +67,22 @@ namespace return; /// Signal received too late. - if (info->si_value.sival_int != sequence_num.load(std::memory_order_relaxed)) + int notification_num = info->si_value.sival_int; + if (notification_num != sequence_num.load(std::memory_order_acquire)) return; /// All these methods are signal-safe. const ucontext_t signal_context = *reinterpret_cast(context); - stack_trace.emplace(signal_context); + stack_trace = StackTrace(signal_context); StringRef query_id = CurrentThread::getQueryId(); query_id_size = std::min(query_id.size, max_query_id_size); if (query_id.data && query_id.size) memcpy(query_id_data, query_id.data, query_id_size); - int notification_num = info->si_value.sival_int; + /// This is unneeded (because we synchronize through pipe) but makes TSan happy. + data_ready_num.store(sequence_num, std::memory_order_release); + ssize_t res = ::write(notification_pipe.fds_rw[1], ¬ification_num, sizeof(notification_num)); /// We cannot do anything if write failed. @@ -79,7 +92,7 @@ namespace } /// Wait for data in pipe and read it. - bool NO_SANITIZE_THREAD wait(int timeout_ms) + bool wait(int timeout_ms) { while (true) { @@ -127,7 +140,7 @@ namespace } -NO_SANITIZE_THREAD StorageSystemStackTrace::StorageSystemStackTrace(const StorageID & table_id_) +StorageSystemStackTrace::StorageSystemStackTrace(const StorageID & table_id_) : IStorageSystemOneBlock(table_id_) { notification_pipe.open(); @@ -160,7 +173,7 @@ NamesAndTypesList StorageSystemStackTrace::getNamesAndTypes() } -void NO_SANITIZE_THREAD StorageSystemStackTrace::fillData(MutableColumns & res_columns, const Context &, const SelectQueryInfo &) const +void StorageSystemStackTrace::fillData(MutableColumns & res_columns, const Context &, const SelectQueryInfo &) const { /// It shouldn't be possible to do concurrent reads from this table. std::lock_guard lock(mutex); @@ -180,7 +193,7 @@ void NO_SANITIZE_THREAD StorageSystemStackTrace::fillData(MutableColumns & res_c pid_t tid = parse(it->path().filename()); sigval sig_value{}; - sig_value.sival_int = sequence_num.load(std::memory_order_relaxed); + sig_value.sival_int = sequence_num.load(std::memory_order_acquire); if (0 != ::sigqueue(tid, sig, sig_value)) { /// The thread may has been already finished. @@ -192,15 +205,15 @@ void NO_SANITIZE_THREAD StorageSystemStackTrace::fillData(MutableColumns & res_c /// Just in case we will wait for pipe with timeout. In case signal didn't get processed. - if (wait(100)) + if (wait(100) && sig_value.sival_int == data_ready_num.load(std::memory_order_acquire)) { - size_t stack_trace_size = stack_trace->getSize(); - size_t stack_trace_offset = stack_trace->getOffset(); + size_t stack_trace_size = stack_trace.getSize(); + size_t stack_trace_offset = stack_trace.getOffset(); Array arr; arr.reserve(stack_trace_size - stack_trace_offset); for (size_t i = stack_trace_offset; i < stack_trace_size; ++i) - arr.emplace_back(reinterpret_cast(stack_trace->getFramePointers()[i])); + arr.emplace_back(reinterpret_cast(stack_trace.getFramePointers()[i])); res_columns[0]->insert(tid); res_columns[1]->insertData(query_id_data, query_id_size); From b9df795595a9b9ade9596bdeb1bd07f234fa6ee7 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Tue, 22 Dec 2020 11:16:36 +0300 Subject: [PATCH 12/14] Another code for TSan --- src/Storages/System/StorageSystemStackTrace.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Storages/System/StorageSystemStackTrace.cpp b/src/Storages/System/StorageSystemStackTrace.cpp index dd21495ed4b..e47852c6045 100644 --- a/src/Storages/System/StorageSystemStackTrace.cpp +++ b/src/Storages/System/StorageSystemStackTrace.cpp @@ -39,6 +39,7 @@ namespace std::atomic sequence_num = 0; /// For messages sent via pipe. std::atomic data_ready_num = 0; + std::atomic signal_latch = 0; /// Only need for thread sanitizer. /** Notes: * Only one query from the table can be processed at the moment of time. @@ -71,6 +72,10 @@ namespace if (notification_num != sequence_num.load(std::memory_order_acquire)) return; + bool expected = false; + if (!signal_latch.compare_exchange_strong(expected, true, std::memory_order_acquire)) + return; + /// All these methods are signal-safe. const ucontext_t signal_context = *reinterpret_cast(context); stack_trace = StackTrace(signal_context); @@ -81,7 +86,7 @@ namespace memcpy(query_id_data, query_id.data, query_id_size); /// This is unneeded (because we synchronize through pipe) but makes TSan happy. - data_ready_num.store(sequence_num, std::memory_order_release); + data_ready_num.store(notification_num, std::memory_order_release); ssize_t res = ::write(notification_pipe.fds_rw[1], ¬ification_num, sizeof(notification_num)); @@ -89,6 +94,8 @@ namespace (void)res; errno = saved_errno; + + signal_latch.store(false, std::memory_order_release); } /// Wait for data in pipe and read it. From c6d3f2722e16e155e9cee9f57f551f9a62cfeab7 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Tue, 22 Dec 2020 11:21:18 +0300 Subject: [PATCH 13/14] Revert unneeded changes --- src/Common/StackTrace.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Common/StackTrace.cpp b/src/Common/StackTrace.cpp index 38a2235d516..b285a45bdc5 100644 --- a/src/Common/StackTrace.cpp +++ b/src/Common/StackTrace.cpp @@ -252,12 +252,12 @@ void StackTrace::symbolize(const StackTrace::FramePointers & frame_pointers, siz #endif } -NO_SANITIZE_THREAD StackTrace::StackTrace() +StackTrace::StackTrace() { tryCapture(); } -NO_SANITIZE_THREAD StackTrace::StackTrace(const ucontext_t & signal_context) +StackTrace::StackTrace(const ucontext_t & signal_context) { tryCapture(); @@ -295,17 +295,17 @@ void StackTrace::tryCapture() #endif } -size_t NO_SANITIZE_THREAD StackTrace::getSize() const +size_t StackTrace::getSize() const { return size; } -size_t NO_SANITIZE_THREAD StackTrace::getOffset() const +size_t StackTrace::getOffset() const { return offset; } -const NO_SANITIZE_THREAD StackTrace::FramePointers & StackTrace::getFramePointers() const +const StackTrace::FramePointers & StackTrace::getFramePointers() const { return frame_pointers; } From aedb1874aff23cfe99450b01e454ff583326fed7 Mon Sep 17 00:00:00 2001 From: alexey-milovidov Date: Wed, 23 Dec 2020 04:40:23 +0300 Subject: [PATCH 14/14] Fix clang-tidy --- src/Storages/System/StorageSystemStackTrace.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Storages/System/StorageSystemStackTrace.cpp b/src/Storages/System/StorageSystemStackTrace.cpp index e47852c6045..0b5e82a1f3d 100644 --- a/src/Storages/System/StorageSystemStackTrace.cpp +++ b/src/Storages/System/StorageSystemStackTrace.cpp @@ -39,7 +39,7 @@ namespace std::atomic sequence_num = 0; /// For messages sent via pipe. std::atomic data_ready_num = 0; - std::atomic signal_latch = 0; /// Only need for thread sanitizer. + std::atomic signal_latch = false; /// Only need for thread sanitizer. /** Notes: * Only one query from the table can be processed at the moment of time.