traced: Send empty OnTraceData response if tracing not started
Currently if a consumer attempts to ReadBuffers and tracing has not
started the service never returns a response. This commonly occurs when
the consumer fails to start tracing: the service sends OnTracingDisabled
the consumer can't distinguish between this failure and a legitimate
OnTracingDisabled and so calls ReadBuffers and waits forever for
OnTracePacket.
This:
- Changes the service to send an empty response to OnTraceData
allowing finalization in the client to proceed as normal
- Updates perfetto_cmd to be more robust to these kinds of problems
by adding a duration guardrail for background traces
- Updates a log message to make sense for indefinite traces
- Bumps the amount of leeway in the guardrail from 10s to 60s:
finalizing the trace can take some time especially if compression
is enabled
Bug: 137831924
Change-Id: Ie5c48cbd9fd93834d27cee7e0adc1a763d8ac1f0
diff --git a/src/tracing/core/tracing_service_impl_unittest.cc b/src/tracing/core/tracing_service_impl_unittest.cc
index 93348ff..c1ad5cd 100644
--- a/src/tracing/core/tracing_service_impl_unittest.cc
+++ b/src/tracing/core/tracing_service_impl_unittest.cc
@@ -213,6 +213,8 @@
consumer_a->DisableTracing();
consumer_a->WaitForTracingDisabled();
+
+ EXPECT_THAT(consumer_b->ReadBuffers(), ::testing::IsEmpty());
}
TEST_F(TracingServiceImplTest, RegisterAndUnregister) {