From d9b063d707b3f6d0a0c7e3a30eb6b9faa9a5f5e3 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Wed, 17 Jun 2020 15:55:36 -0400 Subject: [PATCH] Fix: invalid discarded events on start/stop without event production MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Observed issue ============== On consecutive start/stop command sequence the reported discarded event count is N * CPU, where N is the number of start/stop pair executed. Note that no event generation occurred between each start/stop pair. lttng start lttng stop Tracing stopped for session auto-20200616-094338 lttng start lttng stop Waiting for data availability Warning: 4 events were discarded, please refer to the documentation on channel configuration. Tracing stopped for session auto-20200616-094338 lttng start lttng stop Waiting for data availability Warning: 8 events were discarded, please refer to the documentation on channel configuration. Tracing stopped for session auto-20200616-094338 The issue was bisected down to: commit 6f9449c22eef59294cf1e1dc3610a5cbf14baec0 (HEAD) Author: Jérémie Galarneau Date: Sun May 10 18:00:26 2020 -0400 consumerd: refactor: split read_subbuf into sub-operations [...] Cause ===== The discarded event local variable, in `consumer_stream_update_stats()` is initialized with the subbuffer sequence count instead of the subbuffer discarded event count. Solution ======== Use the subbuffer discarded event count to initialized the variable. Known drawbacks ========= None Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau Change-Id: I5ff213d0464cdb591b550f6e610bf15085b18888 --- src/common/consumer/consumer-stream.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/common/consumer/consumer-stream.c b/src/common/consumer/consumer-stream.c index b262b54d5..0c6dc8f51 100644 --- a/src/common/consumer/consumer-stream.c +++ b/src/common/consumer/consumer-stream.c @@ -69,8 +69,7 @@ static int consumer_stream_update_stats(struct lttng_consumer_stream *stream, { int ret = 0; uint64_t sequence_number; - const uint64_t discarded_events = - LTTNG_OPTIONAL_GET(subbuf->info.data.sequence_number); + const uint64_t discarded_events = subbuf->info.data.events_discarded; if (!subbuf->info.data.sequence_number.is_set) { /* Command not supported by the tracer. */ -- 2.34.1