TRACY_ON_DEMAND causes "Zone is ended twice" instrumentation failure
Description
I keep getting Zone is ended twice failures when compiled with TRACY_ON_DEMAND. Without this flag it works fine.
I debugged tracy profiler and in the failing cases I am getting QueueType::ZoneEnd before any QueueType::ZoneBegin.
Workaround
I can patch void Worker::ProcessZoneEnd( const QueueZoneEnd& ev ) function to ignore the mismatched QueueType::ZoneEnd, and the issue goes away.
if( td->zoneIdStack.empty() )
{
//ZoneDoubleEndFailure( td->id, td->timeline.empty() ? nullptr : td->timeline.back() );
return;
}
I also needed to ignore timeEnd smaller than zone->Start().
//assert( timeEnd >= zone->Start() );
if (timeEnd < zone->Start()) {
return;
}
Questions
- Where are mismatched
QueueType::ZoneBeginandQueueType::ZoneEndsupposed to be handled? - Is the client supposed to send a coherent stream?
- Or is the server supposed to handle that case?
Additional Information
- Tracy version: 0.11.0, also 0.10.0
- Platform: Windows, OSX
I have had this exact issue for a while now. Would be nice if it got fixed.
I encountered this issue during very early profiler startup in my process. A workaround I found was to delay instrumentation until the profiler is connected. E.g. guarding against tracy::GetProfiler().IsConnected(). The telemetry context active state should be providing this exact guard, but that doesn't seem to cover all cases during early profiler startup.