From 25082b2beca21e00d07253f2955725430a290bc2 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 2 Jan 2020 22:39:05 +0100 Subject: [PATCH] Don't report CPU topology if delayed init is active. Reporting topology requires producer to be available, which creates a deadlock during delayed init data structures construction. Calling GetProducer() results in a call to GetProfilerThreadData(), which in turn calls GetProfilerData() to construct its thread local variable. However, at this point we already are calling GetProfilerData() (to construct the profiler itself). This would result in an incorrect double construction of data, but the code already prevents this by allowing init code to be entered only once. Hence the deadlock. Currently this is a non-issue, as no platform which can report CPU topology needs to use delayed init. --- client/TracyProfiler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 3e593a34..71dc4c20 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -2450,6 +2450,7 @@ void Profiler::CalibrateDelay() void Profiler::ReportTopology() { +#ifndef TRACY_DELAYED_INIT struct CpuData { uint32_t package; @@ -2592,6 +2593,7 @@ void Profiler::ReportTopology() tracy_free( cpuData ); #endif +#endif } void Profiler::SendCallstack( int depth, const char* skipBefore )