Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add log message when stacktrace cannot be obtained for thread #20996

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Storages/System/StorageSystemStackTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <Common/PipeFDs.h>
#include <Common/CurrentThread.h>
#include <common/getThreadId.h>
#include <common/logger_useful.h>


namespace DB
Expand Down Expand Up @@ -150,6 +151,7 @@ namespace

StorageSystemStackTrace::StorageSystemStackTrace(const StorageID & table_id_)
: IStorageSystemOneBlock<StorageSystemStackTrace>(table_id_)
, log(&Poco::Logger::get("StorageSystemStackTrace"))
{
notification_pipe.open();

Expand Down Expand Up @@ -229,6 +231,8 @@ void StorageSystemStackTrace::fillData(MutableColumns & res_columns, const Conte
}
else
{
LOG_DEBUG(log, "Cannot obtain a stack trace for thread {}", tid);

/// Cannot obtain a stack trace. But create a record in result nevertheless.

res_columns[0]->insert(tid);
Expand Down
6 changes: 6 additions & 0 deletions src/Storages/System/StorageSystemStackTrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
#include <ext/shared_ptr_helper.h>
#include <Storages/System/IStorageSystemOneBlock.h>

namespace Poco
{
class Logger;
}

namespace DB
{
Expand All @@ -30,6 +34,8 @@ class StorageSystemStackTrace final : public ext::shared_ptr_helper<StorageSyste
void fillData(MutableColumns & res_columns, const Context & context, const SelectQueryInfo & query_info) const override;

mutable std::mutex mutex;

Poco::Logger * log;
};

}
Expand Down