Merge pull request #44948 from ClickHouse/fix-TraceCollector-fix

Fix exception fix in TraceCollector dtor
This commit is contained in:
Robert Schulze 2023-01-05 23:16:40 +01:00 committed by GitHub
commit 9f8b0bf149
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,18 +31,20 @@ TraceCollector::TraceCollector(std::shared_ptr<TraceLog> trace_log_)
TraceCollector::~TraceCollector()
try
{
if (!thread.joinable())
LOG_ERROR(&Poco::Logger::get("TraceCollector"), "TraceCollector thread is malformed and cannot be joined");
else
stop();
try
{
if (!thread.joinable())
LOG_ERROR(&Poco::Logger::get("TraceCollector"), "TraceCollector thread is malformed and cannot be joined");
else
stop();
TraceSender::pipe.close();
}
catch (...)
{
tryLogCurrentException("TraceCollector");
TraceSender::pipe.close();
}
catch (...)
{
tryLogCurrentException("TraceCollector");
}
}