mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Don't drop all traces if frequency is too high
This commit is contained in:
parent
796dfeb44e
commit
f031d064b6
@ -47,11 +47,17 @@ namespace
|
||||
/// Thus upper bound on query_id length should be introduced to avoid buffer overflow in signal handler.
|
||||
constexpr size_t QUERY_ID_MAX_LEN = 1024;
|
||||
|
||||
thread_local size_t write_trace_iteration = 0;
|
||||
|
||||
void writeTraceInfo(TimerType timer_type, int /* sig */, siginfo_t * info, void * context)
|
||||
{
|
||||
/// Quickly drop if signal handler is called too frequently.
|
||||
/// Otherwise we may end up infinitelly processing signals instead of doing any useful work.
|
||||
if (info && info->si_overrun > 0)
|
||||
++write_trace_iteration;
|
||||
if (info
|
||||
&& info->si_overrun > 0
|
||||
/// But pass with some frequency to avoid drop of all traces.
|
||||
&& write_trace_iteration % info->si_overrun != 0)
|
||||
return;
|
||||
|
||||
constexpr size_t buf_size = sizeof(char) + // TraceCollector stop flag
|
||||
|
Loading…
Reference in New Issue
Block a user