Fix: trace chunk reported unknown before close command execution
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 30 Sep 2019 19:57:33 +0000 (15:57 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 30 Sep 2019 22:22:17 +0000 (18:22 -0400)
commit6b584c2ece62c620a86cf438bb358a9da7962b7e
tree0e1b1606ecd492a8f28a1ad3b99a16f140375be3
parentd9c6b5f258e9b72fb1da7492f4001dd0976e9886
Fix: trace chunk reported unknown before close command execution

The check for the existence of a trace chunk is done by using the
regular 'find' operations on a trace chunk registry in both the relay
and consumer daemons.

The 'find' operations attempt to acquire a reference to the trace
chunk being looked-up. On failure to acquire a reference, a trace
chunk is reported as being "unknown". The rotation completion check
uses this mechanism to determine if a trace chunk is still in use.

A close command defers a given operation until a trace chunk is no
longer in use (when its last reference is dropped). Hence, a thread
can attempt to 'find' a trace chunk, fail to acquire a reference, and
fail to see the effects of the close command.

In other words, the thread that has dropped the last reference to
the chunk could still be running the close command of a trace chunk
that is reported to be "unknown" by the consumer and relay daemons.

To fix this, dedicated "chunk_exists" operations are introduced. These
operations do not attempt to acquire a trace chunk. They only look it
up in the registry's internal hash table. As the removal of the trace
chunk from the hash table is performed _after_ the execution of its
close command, it provides a reliable way to ensure that a chunk that
had a close command could complete it before being reported as
"unknown"/no longer in use.

In terms of provided guarantees, this changes the moment at which a
trace chunk is considered to no longer exist from the moment its last
reference was dropped to the moment after the execution of its close
command has completed.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-relayd/main.c
src/bin/lttng-relayd/sessiond-trace-chunks.c
src/bin/lttng-relayd/sessiond-trace-chunks.h
src/common/consumer/consumer.c
src/common/trace-chunk-registry.h
src/common/trace-chunk.c
This page took 0.026021 seconds and 4 git commands to generate.