Fix: don't access packet header for stream_id and stream_instance_id getters
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 10 Apr 2019 14:31:47 +0000 (10:31 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 10 Apr 2019 15:14:57 +0000 (11:14 -0400)
commit8bd661ad2eefa1c7a8b98a330e713ccaa2049259
tree641f339ed3d6ded0e6dc0b910165a327a0bbb9b1
parent13d2c5baf1565ba1daa2b96f5e4a297571c505b4
Fix: don't access packet header for stream_id and stream_instance_id getters

The stream ID and stream instance ID are invariant for a stream, so
there is no point reading them from the packet header currently owned by
the consumer (between get/put subbuf).

Actually, the consumer try to access the stream_id from the live timer
when sending a live beacon without getting the reader subbuffer first.
Doing so is racy against producers. In typical live scenarios
(non-overwrite channels), the producers will always write the same
stream id and stream instance id values at the same header offsets,
which will "work", except for the initial state of an empty buffer:
the value "0" will be returned (erroneously).

For the less frequently used scenario of a live session with "overwrite"
channels, this is handled by issuing a CHAN_WARN_ON, which disables
tracing for the channel, and prints warning to the consumerd console
when running consumerd with LTTNG_UST_DEBUG=1.

In the case where a ring buffer does not have any data ready, it makes
no sense to try to get a subbuffer for reading anyway, so the approach
was broken.

So return the stream id and stream instance id from the internal
data structures rather than reading it from the ring buffer.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust/lttng-ring-buffer-client.h
This page took 0.024567 seconds and 4 git commands to generate.