Mathieu Desnoyers [Wed, 14 Aug 2019 20:32:58 +0000 (16:32 -0400)]
Fix: consumer: put each chunk on teardown
Trace chunks in the registry may still exist because those are top-level
entities for which we may have received a "create" command from session
daemon without pairing "destroy". Iterate on the entire chunk registry
and put the sessiond reference for each chunk on consumerd teardown
Fixes the following assert on teardown caused by non-empty registry on
SIGINT:
lttng-consumerd: trace-chunk.c:1109: lttng_trace_chunk_registry_destroy: Assertion `!ret' failed.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 30 Aug 2019 22:10:56 +0000 (18:10 -0400)]
Fix: validate that session, host and basepath are legal
Ensure that session name, hostname and the session's base path
do not contain dots ('.') to safeguard against malformed names
that could be used to walk-up the relay daemon output path
hierarchy.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 14 Aug 2019 17:30:28 +0000 (13:30 -0400)]
Fix: honor base path for network URIs
Starting from 2.11, the following use-case stopped working as expected:
lttng create --set-url=net://localhost/my/path/custom
lttng enable-event -u -a
lttng start
[ run app ]
The output trace is expected in the following directory on the relayd
(no timestamp suffix):
$LTTNG_HOME/lttng-traces/[hostname]/my/path/custom
Add the base_path information to the session object in the session
daemon, extracted from the network URI, and pass that information to the
relay daemon through the create session (2.11) command.
It also fixes the use-case:
lttng create --snapshot --set-url=net://localhost/my/path/custom
lttng enable-event -u -a
lttng start
[ run app ]
lttng snapshot record
which is expected to record the snapshot under:
$LTTNG_HOME/lttng-traces/[hostname]/my/path/custom/snapshot-[N]-[timestamp]
Similar situation for:
lttng create --snapshot
lttng enable-event -u -a
lttng start
[ run app ]
lttng snapshot record net://localhost/my/path/custom
which is expected to record the snapshot under:
$LTTNG_HOME/lttng-traces/[hostname]/my/path/custom/snapshot-[N]-[timestamp]
Note that specifying the base_path on the snapshot record command
overrides the base path specified at create.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 3 Sep 2019 17:01:09 +0000 (13:01 -0400)]
Fix: bindings import segfaults on missing hash_key_u64
A mishandled error in SWIG-generated code causes the Python3
interpreter to segfault when a missing symbol is reported during
the linking (at runtime) against liblttng-ctl.
libcommon makes use of the internal libhashtable.la since the
addition of the lttng_trace_chunk interface. This introduces
a transitive dependency to libhashtable.la in liblttng-ctl.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 14 Aug 2019 14:52:49 +0000 (10:52 -0400)]
Cleanup: typo: overriden -> overridden
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 13 Aug 2019 20:38:47 +0000 (16:38 -0400)]
Fix: relay: relay_rotate_session_streams uninitialized return value
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 13 Aug 2019 20:27:51 +0000 (16:27 -0400)]
Fix: test_kernel rotation: expect 60 rather than 64
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 13 Aug 2019 20:25:16 +0000 (16:25 -0400)]
Save registration time for app
Reuse the registration time for path generation.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 13 Aug 2019 19:52:52 +0000 (15:52 -0400)]
Fix: tests: update rotation ust number of tests
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 27 Aug 2019 21:54:00 +0000 (17:54 -0400)]
Clean-up: missing word `lock` in comment
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 27 Aug 2019 21:03:45 +0000 (17:03 -0400)]
Use case-scope error labels handling LTTNG_CONSUMER_ROTATE_CHANNEL
This cleans-up the error handling of the case handling the
LTTNG_CONSUMER_ROTATE_CHANNEL command. This is done in order to allow a
follow-up commit to perform some common clean-up operations on error
while introducing as few changes as possible.
No behaviour change is intended.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 27 Aug 2019 21:01:16 +0000 (17:01 -0400)]
Use case-scope error labels handling LTTNG_CONSUMER_PUSH_METADATA
This cleans-up the error handling of the case handling the
LTTNG_CONSUMER_PUSH_METADATA command. This is done in order to allow a
follow-up commit to perform some common clean-up operations on error
while introducing as few changes as possible.
No behaviour change is intended.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 27 Aug 2019 20:57:29 +0000 (16:57 -0400)]
Use case-scope error labels when handling LTTNG_CONSUMER_GET_CHANNEL
This cleans-up the error handling of the case handling the
LTTNG_CONSUMER_GET_CHANNEL command. This is done in order to allow a
follow-up commit to perform some common clean-up operations on error
while introducing as few changes as possible.
No behaviour change is intended beyond additional calls to
health_code_update() in some code paths which should have no impact.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 27 Aug 2019 20:49:38 +0000 (16:49 -0400)]
Use case-scope error labels handling LTTNG_CONSUMER_ROTATE_CHANNEL
This cleans-up the error handling of the case handling the
LTTNG_CONSUMER_ROTATE_CHANNEL command. This is done in order to allow
a follow-up commit to perform some common clean-up operations on error
while introducing as few changes as possible.
No behaviour change is intended.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 27 Aug 2019 20:46:36 +0000 (16:46 -0400)]
Use case-scope error labels handling LTTNG_CONSUMER_DESTROY_CHANNEL
This cleans-up the error handling of the case handling the
LTTNG_CONSUMER_DESTROY_CHANNEL command. This is done in order to allow
a follow-up commit to perform some common clean-up operations on error
while introducing as few changes as possible.
No behaviour change is intended.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 27 Aug 2019 20:37:26 +0000 (16:37 -0400)]
Use case-scope error labels handling LTTNG_CONSUMER_STREAMS_SENT
This cleans-up the error handling of the case handling the
LTTNG_CONSUMER_STREAMS_SENT command. This is done in order to allow a
follow-up commit to perform some common clean-up operations on error
while introducing as few changes as possible.
No behaviour change is intended.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 27 Aug 2019 20:19:34 +0000 (16:19 -0400)]
Use case-scope error labels when handling LTTNG_CONSUMER_ADD_STREAM
This cleans-up the error handling of the case handling the
LTTNG_CONSUMER_ADD_STREAM command. This is done in order to allow a
follow-up commit to perform some common clean-up operations on error
while introducing as few changes as possible.
No behaviour change is intended beyond additional calls to
health_code_update() in some code paths which should have no impact.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 24 Aug 2019 23:58:48 +0000 (16:58 -0700)]
Clean-up: set stream's channel pointer to NULL after releasing ref
A stream's "chan" pointer to its parent channel remains set after
the reference to the channel has been released. This can lead to
accidental uses after the release of the channel through the
stream object.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 24 Aug 2019 23:08:33 +0000 (16:08 -0700)]
Fix: mark consumer channels as logically deleted during deletion
A consumer channel that is "logically" deleted (but not yet reclaimed
with regards to RCU) can be iterated-on when creating a trace chunk.
Such a deleted channel will have released its reference to its
previous trace chunk, but the trace chunk creation operation will
set its current trace chunk to the new trace chunk, thus acquiring
a new reference to the trace chunk.
The clean-up performed by the RCU thread already assumes that a
logical deletion already took place and will not re-release the
reference to the channel's current trace chunk.
In effect, the reference to the trace chunk is leaked and will
prevent any rotation out of the trace chunk from completing.
Reported-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 24 Aug 2019 22:14:11 +0000 (15:14 -0700)]
Cleanup: mark utils_get_home_dir as returning a const string
utils_get_home_dir() returns a string obtained from getenv() that
should not be modified nor free'd. However, utils_get_user_home_dir()
returns the path as a copy.
The return parameter of utils_get_home_dir() is marked as const
to underline this difference and prevent mix-ups in the use of
those functions.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Mon, 12 Aug 2019 21:30:45 +0000 (17:30 -0400)]
Fix: use utils_get_home_dir for anonymous trace chunk path
The default behaviour of lttng_directory_handle_init will set
the current working directory if opt_output_path is null.
Instead we want to honour LTTNG_HOME/HOME.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 13 Aug 2019 19:29:29 +0000 (15:29 -0400)]
Fix: tests: typo in rotation util
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 13 Aug 2019 19:28:34 +0000 (15:28 -0400)]
Fix: keep ust/kernel session items around for destroy notifier
Split the destruction and release operations for ust and kernel
inner-sessions as they may be accessed by session destruction
notifiers registered against their parent ltt_session.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 23 Aug 2019 00:35:17 +0000 (17:35 -0700)]
Tests: add a test for the "skip non-empy" rmdir flag
Add tests for the newly introduced "skip non-empty" flag that
was added to the lttng_directory_handle interface's
"remove_subdirectory_recursive" function.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 12 Aug 2019 21:25:19 +0000 (17:25 -0400)]
Fix: rmdir recursive: skip non-empty directories with flag
Restore the behavior of LTTng 2.10 with a flag.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 21 Aug 2019 22:24:12 +0000 (15:24 -0700)]
Fix: uninitialized variable returned by relay_rotate_session_streams
`ret` can be returned uninitialized when relay_rotate_session_streams
succeeds. Initialize it to 0 on the successful code path.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 12 Aug 2019 16:16:18 +0000 (12:16 -0400)]
Fix: allow quiet rotation at destroy of live session
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 12 Aug 2019 15:47:34 +0000 (11:47 -0400)]
Fix: relayd: live: read index file header
The header of index files opened in "read" mode are not validated
when the file is being opened. This check should be performed to
restore the previous behaviour.
Moreover, the rest of the code using index files in "read" mode
assumes that the file header has already been skipped when reading
index entries.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 12 Aug 2019 15:46:34 +0000 (11:46 -0400)]
Fix: index: use parenthesis around define
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Fri, 9 Aug 2019 21:01:35 +0000 (17:01 -0400)]
Fix: test_crash: don't kill first app twice
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 9 Aug 2019 20:40:34 +0000 (16:40 -0400)]
Fix: perform a rotation to a null trace chunk on session destruction
In order to guarantee the consumption of all data by the time a
session's destruction completes, a rotation to a "null" trace chunk is
performed as part of a session's destruction.
This ensures that a session is only reclaimed when all of its
streams (on both the consumers and the relay daemon) have been
destroyed.
The notion of a "quiet" rotation is introduced in order to re-use the
session rotation infrastructure, but without the rotation being
visible to external users through either the notification system or a
rename of the trace output folder.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 9 Aug 2019 21:56:39 +0000 (17:56 -0400)]
relayd: log destination trace chunk of ROTATE_STREAMS command
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 9 Aug 2019 18:00:22 +0000 (14:00 -0400)]
Clean-up: declare dummy pipe payload as a char instead of a string
Only the first byte of the 'dummy' string is used. Hence, a single
char can be used.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Fri, 9 Aug 2019 16:25:57 +0000 (12:25 -0400)]
Fix: consumer: assert that stream chunk != NULL (not channel)
This assert sometimes triggers in
tests/regression/tools/crash/test_crash: test_shm_path_per_pid_sigint
because the destroy is performed when there is still unflushed data in
the buffers. The destroy performs a chunk close on the consumer daemon,
which effectively sets the channel chunk to NULL, while there are still
references to the chunk in the streams (which are still active).
Change the assertion in the stream read to validate that stream chunk !=
NULL instead.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 9 Aug 2019 15:18:47 +0000 (11:18 -0400)]
relayd fix: trace chunk is reclaimed before close command
The relay daemon control protocol defines a trace chunk close command
which allows the tracer to express the 'end' time bound of a trace
chunk.
However, in the event of a session rotation, the last reference to
such a trace chunk can be released before the close command is
received. This prevents the trace chunk from being renamed and moved
at the completion of a rotation.
A reference to a 'pending closure' trace chunk is kept as part of the
relay session object until its 'close' command is received.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 9 Aug 2019 15:11:28 +0000 (11:11 -0400)]
Fix: rotation of a stopped session hangs indifinitely
The relay daemon control protocol expects a rotation position as "the
sequence number of the first packet _after_ the current trace chunk.
At the moment when the positions of the buffers are sampled, the
production position does not necessarily sit at a packet boundary. The
'active' flush operation above will push the production position to
the next packet boundary _if_ it is not already sitting at such a
boundary.
Assuming a current production position that is not on the bound of a
packet, the 'target' sequence number is
(consumed_pos / subbuffer_size) + 1
Note the '+ 1' to ensure the current packet is part of the current
trace chunk.
However, if the production position is already at a packet boundary,
the '+ 1' is not necessary as the last packet of the current chunk is
already 'complete'.
In the case of a stopped session, performing the '+ 1'
indiscriminately results in a position that will not be reached until
another (not 'active') flush occurs.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 8 Aug 2019 20:39:56 +0000 (16:39 -0400)]
Fix: initialize kernel stream max subbuffer size on creation
A consumer stream's maximal subbuffer size is only initialized while
taking a snapshot. This unexpectedly leaves the max_sb_size at 0
causing the rotation target sequence number computation to crash with
a SIGFPE.
This fix initializes the value as soon as possible to provide a
behaviour in line with that of the ust-consumer.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 8 Aug 2019 20:38:48 +0000 (16:38 -0400)]
Fix: use relay_id from ust_session or kernel_session consumer
The consumer_output of an ltt_session does not contain the relay
daemon id in the case of a remote session. Hence, it must be fetched
from the domain-specific sessions.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 8 Aug 2019 20:29:38 +0000 (16:29 -0400)]
Fix: lttng-ctl: public session.h control API: restore 0 success return value
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 8 Aug 2019 19:27:51 +0000 (15:27 -0400)]
Fix: remote kernel stream paths contain too much information
The kernel stream paths, when built with a "net" consumer type,
contain the hostname and session name. This is redundant and must not
be transmitted to 2.11+ relay daemons. Otherwise, this results in an
erronerous path hierarchy on the remote end.
Stream paths transmitted to a trace chunk-aware peer are relative to a
session's output trace chunk.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 8 Aug 2019 17:53:19 +0000 (13:53 -0400)]
Fix: destroy command: send credentials with command
Not sending credentials triggers spurious destroy command failure
(EPERM) because session daemon receives "nobody.nobody" credentials.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 8 Aug 2019 04:55:51 +0000 (00:55 -0400)]
relayd: open live viewer files from the current stream's trace chunk
Since relay_streams' paths are now relative to a session's trace
chunk, file operations performed by the live protocol handler must
occur through a trace chunk.
Note that viewer streams hold a reference to the current trace chunk
of their corresponding relay stream. This is fine right now as no
session rotations may occur during the lifetime of a live session. If
this was allowed, this would be a problem since a session rotation
would not complete until all live viewer streams release their
reference to the trace chunk.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 7 Aug 2019 18:27:24 +0000 (14:27 -0400)]
Fix: don't perform an automatic session rotation in snapshot mode
An automatic session rotation is performed on destruction if more than
one trace chunk was created during the lifetime of a session. This is
not a good criterion to use in no-output/snapshot mode as multiple
trace chunks may have been created during a session's lifetime.
The "output_traces" flag is checked explicitly to prevent an automatic
session rotation from happenning on destroy.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 7 Aug 2019 18:21:11 +0000 (14:21 -0400)]
Fix: incorrect time unit used when waiting on destruction handle
DEFAULT_DATA_AVAILABILITY_WAIT_TIME is used by the lttng client to
wait on the destruction handle returned by a session destruction
command. This constant is in micro-seconds while the destruction
handle expects a timeout in ms.
This causes the client to appear unresponsive while waiting for
the destruction of a session.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 1 Aug 2019 18:42:32 +0000 (14:42 -0400)]
relayd: implement file and session rotation on top of trace chunks
Implement the file and session rotation functionality on top of the
trace chunk API. This ensures that a relay_stream and lttng_index_file
are always explicitly associated to a trace chunk and hold a reference
to it as long as their underlying files are contained within a given
trace chunk.
A number of relay_stream specific functions are moved to stream.c as
"methods" of the relay_stream interface in order to make use of
internal relay_stream helpers.
As part of this clean-up/move of the relay_stream code, raw payload
buffer handling has been replaced to use the lttng_buffer_view
interface which provides implicit bounds checking of the payload
buffers.
The stream rotation has been modified to reference a "new chunk id"
which is the ID of the trace chunk to which streams should rotate
"into". The command has also been modified to apply on a set of
streams. This is done in order to limit the number of commands on the
control socket. Conversely, all path names have been removed from the
command's payload.
The index file implementation now acquires a reference to the trace
chunk from which it is created. This affects the consumer daemon as
this code is shared with the relay daemon. This ensures that a chunk
is not released (and its close command executed, if any) before all
file descriptors related to it have been closed. Respecting this
guarantee is very important as the upcoming fd-cache will remove
the guarantee that an "fd" to a given file is always held open.
Moreover, close commands can rename a trace chunk's folders which
would cause files to be created in the wrong folder if they are
not properly created through the trace chunk.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 1 Aug 2019 20:37:15 +0000 (16:37 -0400)]
Fix: remove assertions of the existence of a trace chunk
A session can have no trace chunk on the session daemon and
consumer daemon end whenever its ouput is remote (relayd) and
doesn't support trace chunks.
The assertions removed as part of this patch are overly strict
considering that there are valid cases when trace_chunk can
be NULL.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 1 Aug 2019 20:35:27 +0000 (16:35 -0400)]
Fix: only create trace chunk if the output of a session supports it
A trace chunk should only be created on the session daemon end when
the trace's output supports this notion (2.11+).
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 31 Jul 2019 03:37:39 +0000 (23:37 -0400)]
Fix: use stream's current tracefile count rather than the max
consumer_stream_create_output_files() formats the file name of a
stream's data file by passing the tracefile count setting rather than
using `tracefile_count_current`, the current "index" within the
on-disk ring buffer. This broke the trace file rotation functionality
as the same file would be overwritten continuously.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 25 Jul 2019 19:35:21 +0000 (15:35 -0400)]
relayd: use bool for is_metadata relay_stream attribute
The `is_metadata` attribute of a relay_stream is currently
a int32_t while it is used as a boolean.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 25 Jul 2019 19:30:54 +0000 (15:30 -0400)]
relayd: create stream files relative to a session's trace chunk
Like to the consumer daemon, the relay daemon now creates its
stream files through the lttng_trace_chunk interface. This
requires changes across the session daemon and relay daemon.
The changes to the relay daemon mainly target the file creation.
In the session daemon, the snapshot command has been heavily
modified to fully initialize the ltt_session's ust and kernel
consumer_outputs _before_ the snapshot trace chunk is created.
This way, the session is setup in the same way a regular network
streaming session would be, a temporary trace chunk is created to
contain the snapshot's content, the actual snapshot is taken, and
the session's original consumer_outputs are restored.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 24 Jul 2019 21:07:00 +0000 (17:07 -0400)]
Fix: leak of consumer_output when using an explicit snapshot output
The consumer_output of a snapshot_output is leaked whenever a
snapshot is taken on a session that doesn't have pre-configured
snapshot outputs.
Steps to reproduce the leak:
$ lttng create --snapshot
$ lttng snapshot del-output 1
$ lttng enable-event -u -a
$ lttng start
$ lttng snapshot record /tmp/leak_it
This results in a leak of ~24kb/snapshot as reported by valgrind.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 23 Jul 2019 20:45:48 +0000 (16:45 -0400)]
Fix: reception buffer of control connection is leaked
The reception buffers of control connections are not "reset" on
destruction, resulting in their underlying storage buffer being
leaked. The typical (observed) size of the leak is 8kb per control
connection.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 22 Jul 2019 21:55:38 +0000 (17:55 -0400)]
Fix: ensure a newline is printed before exit on client destroy
Errors encountered during the destruction of a session can cause
the `lttng` client to exit after having printed the
'Waiting for destruction of session ...' message without printing
a newline. This causes the user's prompt to reappear after the
message and not on a new line.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 19 Jul 2019 22:54:10 +0000 (18:54 -0400)]
Send session creation time to relay daemon when supported
A recent commit changed the way the creation timestamp was added to a
session's output path; the session creation timestamp is now (2.11+)
sampled at creation time and formatted when the session's output
directory is created.
The 2.11+ version of the session and stream creation commands allow
the relay daemon to use all components of the path independently to
format an output path rather than relying on the session daemon peer
to format it ahead of time.
In order to maintain the timestamped session folder name created by
previous versions, the relay daemon now receives the session's
creation timestamp and formats it rather than relying on it being
"cooked" into the transmitted session name.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 18 Jul 2019 20:11:59 +0000 (16:11 -0400)]
relayd: remove unnecessary allocation in session path formatting
`alloc_path` merely contains the contents of `default_path`.
The allocation of `alloc_path` can be removed and `default_path`
used in its place.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 18 Jul 2019 19:32:57 +0000 (15:32 -0400)]
relayd: add remote trace chunk close command
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 17 Jul 2019 19:12:49 +0000 (15:12 -0400)]
Create userspace buffers using ua_sess effective credentials
While a session's trace chunk shares its credentials, a trace
chunk's credentials are unset when the output is not local. Hence,
the session's effective credentials must be used.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 17 Jul 2019 18:46:56 +0000 (14:46 -0400)]
Use lttng_credentials instead of bespoke uid/gid members in ua_sess
Change euid/egid and uid/gid to use the lttng_credentials structure
under the "effective_credentials" and "real_credentials" names.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 16 Jul 2019 19:31:36 +0000 (15:31 -0400)]
relayd: add remote trace chunk creation command
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 16 Jul 2019 18:45:36 +0000 (14:45 -0400)]
Add .clang-format
Add a first draft of a .clang-format. I have attempted to set it up
so that it conforms to the project's usual coding convention.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 16 Jul 2019 01:24:41 +0000 (21:24 -0400)]
Don't allow slashes and dots in overriden trace chunk names
A trace chunk's name is used when building its path. Therefore,
we ensure that a chunk's name can never contain '/' or '.' in
order to prevent malicious trace chunk names that would escape
a session's output directory.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 4 Jul 2019 13:04:53 +0000 (09:04 -0400)]
relayd: Retrieve a relay_session's trace chunk on creation
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 4 Jul 2019 13:03:54 +0000 (09:03 -0400)]
relayd: Transmit current trace chunk id in create_sesssion command
The relay daemon needs the current chunk id to query (when it is set)
the sessiond trace chunk registry and retrieve the instance of the
trace chunk if it is already available during the session's
creation.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 4 Jul 2019 12:59:08 +0000 (08:59 -0400)]
Use a "comm" variant of the LTTNG_OPTIONAL helper in sessiond-comm
The LTTNG_OPTIONAL helper is currently communication safe (as long
as LTTNG_PACKED is used). However, this could change in the future.
An LTTNG_OPTIONAL_COMM alias is introduced in order to make it easier
to change the layout of LTTNG_OPTIONAL should it become necessary
in the future.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 3 Jul 2019 20:23:28 +0000 (16:23 -0400)]
Remove unused relay daemon commands
Remove the now-unused rename, mkdir, and rotation pending commands
that are replaced by the trace chunk infrastructure.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 19 Feb 2019 21:48:23 +0000 (16:48 -0500)]
relayd: create an implicit trace chunk on session creation
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 12 Mar 2019 21:20:34 +0000 (17:20 -0400)]
relayd: create sessiond trace chunk registry on session creation
Use the sessiond_trace_chunk_registry_session_created() and
sessiond_trace_chunk_registry_session_destroyed() to allow the
sessiond trace chunk registry the ability to manage trace chunk
registries associated with the various session daemons from which
the consumer daemon connections originate.
These notifiers effectively manipulate the reference count (and
create/destroy, as needed) of the lttng_trace_chunk_registry
associated with each session daemon (using their UUID).
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 2 Jul 2019 19:00:39 +0000 (15:00 -0400)]
Use directory handle to rename trace chunk directory
Replace uses of renameat() with the directory handle
compatiblity-layer for systems that don't support directory
file descriptors.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 29 Jun 2019 03:01:23 +0000 (23:01 -0400)]
Docs: add directory handle header documentation
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 28 Jun 2019 21:14:11 +0000 (17:14 -0400)]
Add rmdirat and renameat to run-as commands
Add support for the rmdirat and renameat commands to the run-as
infrastructure. These commands use the directory_handle compatibility
layer to provide rename and directory deletion relative to a
(or multiple) directory file descriptors.
The rmdirat name is used even though there are no rmdirat syscall
(at least on Linux). The functionality that would be provided by
rmdirat() (vs rmdir) is provided through unlinkat(..., AT_REMOVEDIR).
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 24 Jun 2019 20:41:50 +0000 (16:41 -0400)]
Print the location of trace chunk produced at session destruction
The destruction of a session that was rotated during its lifetime
will cause an "implicit" rotation to close the last trace archive.
This change makes the CLI client use the newly added destruction
handle interface of liblttng-ctl to print the location of the
last trace archive produced during the destruction of a session
(when applicable).
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 24 Jun 2019 19:08:36 +0000 (15:08 -0400)]
Docs: misleading documentation of compat_epoll_create
The documentation of compat_epoll_create explicitly mentions that
it can't fail because of a memory allocation error. This is false
as the function allocates an array of struct epoll_event.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 24 Jun 2019 19:07:59 +0000 (15:07 -0400)]
Remove unused ust_sock member of command_ctx
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 18 Jun 2019 18:12:45 +0000 (14:12 -0400)]
Tests: clarify the tap output of the kernel session rotation test
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 18 Jun 2019 18:05:46 +0000 (14:05 -0400)]
Fix: wait for the completion of implicit session rotations
A session that has been rotated within its lifetime will be
rotated during its destruction to rename the last trace chunk.
Currently, the liblttng-ctl library's session destruction function
only waits for the data pending to indicate that all data has
been consumed. This used to be sufficient, but it is now necessary
to wait for the implicit session rotation to complete.
The "wait" variant of the session destruction function will wait
for any implicit session rotation to compete. A new
lttng_destruction_handle class is introduced to allow a client to
wait for the destruction of a session and obtain the location of
the last trace archive produced by the implicit session rotation.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 13 Jun 2019 18:41:48 +0000 (14:41 -0400)]
Fix: don't hide EBADF error subbuffer write
There are _no_ legitimate circumstances where a "EBADF" error should
be considered normal in a multi-threaded program.
This doesn't fix a known problem, but it hid an error while testing a
development branch. It is considered a fix since not logging this
error can make debugging more difficult if this was, in fact, hiding a
problem.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 11 Jun 2019 20:03:22 +0000 (16:03 -0400)]
Tests: don't expect a UST directory after inactive per-PID rotation
The trace archive resulting from the rotation of a session containing
per-PID channels does not result in the creation of te domain
subfolders.
The trace archive is empty if none of the traced domain were active
during the trace chunk's capture.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 11 Jun 2019 09:39:46 +0000 (05:39 -0400)]
Tests: remove check for an empty chunk produced on destruction
Consider the following tracing scenario used by the rotation tests:
- Start tracing
- Rotate
- Stop tracing
- Rotate
- Destroy
The session daemon used to produce 3 trace archives when this sequence
of operations occurred. Of course, the third archive would always be
empty as no events can be produced between a stop and a destroy
operation.
As this behaviour is thankfully no longer present, the chunk
validation logic of the test causes it to fail. This patch removes
this logic.
Moreover, since chunk IDs are now 0-based, the test is adjusted to
check for names accouting for this naming scheme.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 10 Jun 2019 17:31:31 +0000 (13:31 -0400)]
Fix: metadata stream is not marked as quiescent after packet commit
When a metadata stream's wait fd is hung-up or enters an error state,
it is checked for quiescence in lttng_ustconsumer_on_stream_hangup().
If the stream is not quiescent, the current packet is closed through
the flush_buffer operation.
Currently, all commits to metadata streams are done on a packet
basis. The various code paths using the commit_one_metadata_packet
helper all perform a flush directly after the commit. Performing this
flush leaves the stream in a "quiescent" state, but does not mark it
as such.
This results in an extraneous flush being performed in the err/hup
handler, which leaves an empty packet to be consumed. This packet is
then consumed during the execution of the err/hup handler.
This bug results in an empty packet being appended to metadata
streams. This packet is typically ignored by readers, but the fact
that it is written at the time of the destruction of a session
violates the immutability guarantee of the session stop
command. Moreover, following the introduction of trace chunks, this
results in the stream attempting to serialize the empty buffer to its
output file _after_ its trace chunk has been closed, causing an
assertion to hit.
Hence, this fix performs the buffer flush and sets the stream as
quiescent directly in commit_one_metadata_packet().
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 21 Feb 2019 23:59:31 +0000 (18:59 -0500)]
Create stream files relative to a stream's current trace chunk
Create stream (and metadata) files relative to a session's current
trace chunk using the lttng_trace_chunk_open/unlink[...] functions
in the consumer daemons.
Four new commands are added to the sessiond <-> consumerd protocol:
- CREATE_TRACE_CHUNK
Command parameters:
- relayd_id: uint64_t
Unique ìd of the session's associated relay daemon connection
- override_name: optional char[]
Overriden chunk name. This field is not used by the consumer
daemon; it is forwarded to the relay daemon in order to set the
name of a trace chunk's directory when it should not follow the
`<ts begin>-<ts end>-<index>` form used by trace archives (i.e. as
produced by session rotations). This is used to preserve the
existing format of snapshot output directory names.
- sessiond_id: uint64_t
Unique id of the session (from the sessiond's perspective) to
which this trace chunk belongs.
- chunk_id: uint64_t
Unique id the the session's trace chunk.
- credentials: pair of uint32_t uid/gid
Credentials the consumer daemon should use in order to create
files within the trace chunk.
The session daemon maintains the current lttng_trace_chunk of an
ltt_session. When a session that has an output (`output_traces` == 1),
an lttng_trace_chunk is created.
In local tracing modes, the current trace chunk of a session, on the
session daemon's end, holds the ownership of the chunk's output
directory.
The CREATE_TRACE_CHUNK command is used to replicate the session
daemon's current trace chunk in the consumer daemon. This
representation of the current trace chunk has a different role. It
is created in "user" mode. Essentialy, the trace chunk's location
is opaque to the consumer daemon; it receives a directory file
descriptor from which a number of stream files will be created.
The trace chunk registry, as used by the consumer daemon, implicitly
owns the trace chunks on behalf of the session daemon. This is only
needed in the consumer since the consumer has no notion of a session
beyond session IDs being used to identify other objects.
When a channel is created, its session_id and initial chunk_id are
provided. This allows the consumer daemon to retrieve the session's
current trace chunk and associate it with the newly-created
channel. The channel holds a reference to its current trace chunk.
Streams created from a channel also hold a reference to their current
trace chunk, as retrived from their "parent" channel.
The life time of trace chunks in the consumer daemon is cooperatively
managed with the session daemon. This means
session daemon through the LTTNG_CONSUMER_CREATE_TRACE_CHUNK and
LTTNG_CONSUMER_CLOSE_TRACE_CHUNK commands.
- CLOSE_TRACE_CHUNK
[... TODO ...]
This command is used to release the global reference to a
given trace chunk in the consumer daemon. Relasing the consumer
daemon's global reference to the trace chunk leaves only the streams
to hold references until the moment when they are either closed or
they switch-over to another chunk in the event of a session rotation.
- TRACE_CHUNK_EXISTS
[... TODO ...]
- ADD_TRACE_CHUNK_CLOSE_COMMAND
[... TODO ...]
This commit changes a lot of code since it essentialy changes how
files and directories are created.
A number of commands no longer need to specify a `trace_archive_id`
since the CREATE_TRACE_CHUNK and CLOSE_TRACE_CHUNK allow the consumer
daemon to keep track of the current trace chunk of a channel at any
given time.
Creation and ownership of channel sub-directories
---
The path expressed in consumer channel objects is now relative to
the current trace chunk rather than being absolute. For example,
the `pathname` of a consumer channel is now of the form
`ust/1000/64-bit` rather than containing the full output path
`/home/me/lttng-traces/session-[...]/ust/1000/64-bit/`.
The subdirectory of a channel (relative to a trace chunk, e.g.
`ust/1000/64-bit`) is lazily created when a stream's output files are
created.
To do so, the `lttng_consumer_channel` now has a
`most_recent_chunk_id` attribute. When a stream creates its output files
(i.e. at the beginning of a session, or during a session rotation),
the stream's current trace chunk `id` is compared to the channel's
`most_recent_chunk_id`. If it is determined that the channel is
entering a new trace chunk, its channel subdirectory is created
relative to the stream's chunk.
Since this new state is within the `lttng_consumer_channel`, the
channel lock must be held on code paths that may result in the
creation of a new set of output files for a given stream.
Note that as of this commit, there is now a clear ownership boundary
between directories, owned by the session daemon through its trace
chunk, and files, owned by the consumer daemon.
Down-scoping of channel credentials
---
Since files are now created relative to their stream's current trace
chunk (which has credentials set), the fewer sites need access to the
channel's credentials. The only reason credentials are kept as part
of the consumer channel structure is the need to open and unlink UST
shared memory mappings. Since the credentials must only be used for
this purpose, they are now stored as an `LTTNG_OPTIONAL` field,
buffer_credentials, that is only set for UST channels.
Stream files should never need those credentials to be created.
The following commands sessiond <-> consumerd commands have been
removed:
- LTTNG_CONSUMER_ROTATE_RENAME
- LTTNG_CONSUMER_CHECK_ROTATION_PENDING_LOCAL
- LTTNG_CONSUMER_CHECK_ROTATION_PENDING_RELAY
- LTTNG_CONSUMER_MKDIR
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 22 May 2019 20:28:39 +0000 (16:28 -0400)]
Cleanup: remove duplicated code in snapshot record command
The session daemon's snapshot record command contains duplicated
code depending on the configuration of the snapshot output. This
makes it harder to modify the code in a follow-up commit.
Those code paths are made const-correct by the same occasion.
No behaviour change is intended.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 23 May 2019 17:34:37 +0000 (13:34 -0400)]
Fix: run_as_mkdirat returns value of errno
The run_as_mkdirat() function returns the _errno value returned
by the run-as worker instead of returning `ret`. This causes
run_as_mkdirat() to return an error when errno was already set
to a non-zero value by a previous libc/system call.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 15 May 2019 15:37:55 +0000 (11:37 -0400)]
Fix: double close of directory fd in runas worker
The run-as worker implements its mkdirat and mkdirat_recursive commands
on top of the lttng_directory_handle interface. When a directory
handle is created from a directory file descriptor, it assumes the
ownership of this file descriptor and it will release it when
lttng_directory_handle_fini() is invoked.
The runas worker's post-command clean-up closes any file descriptor
received from its client. The command structure's `fd` is set to
`-1` in order to make the received file descriptor invalid and
prevent the double-close.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 11 Mar 2019 21:25:45 +0000 (17:25 -0400)]
relayd: add the sessiond_trace_chunk_registry interface
The sessiond_trace_chunk_registry interface allows the relay
daemon to maintain an association between multiple consumer daemon
connections originating from the same session daemon and a common
trace chunk registry.
This trace chunk registry allows separate, but related, connections
to manipulate the same trace chunk.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 30 Jun 2018 18:51:55 +0000 (14:51 -0400)]
Move index initialization to ctf-index.h
This initialization code is moved to a common header to re-use
it in a follow-up patch.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 10 May 2019 16:41:26 +0000 (12:41 -0400)]
Export utils_stream_file_path outside of common/utils.c
utils_stream_file_name is used by the stream file creation and
unlinking utilities. Those utilities perform actions that
will be performed on a trace chunk in a future commit.
Making this util public allows the reuse of most of the code
of the utilities.
The function is renamed from utils_stream_file_name to
utils_stream_file_path since it returns a path and not a
name.
The function's output parameter is moved to the end of the argument
list to honor the convention used in most of the code base. A length
parameter is added rather than relying on an implicit assumption
that the buffer's length is >= PATH_MAX.
The existing callers' buffer size is changed from PATH_MAX to
the preferred LTTNG_PATH_MAX.
The implementation of the function has been reworked to eliminate
a number of unncessary copies and allocations. It is now simpler,
handles path truncations, and does not duplicate the path separator
if it is already contained in `path_name`.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 9 May 2019 18:10:58 +0000 (14:10 -0400)]
Add file creation/unlinking utils to directory handle
This commit adds file creation and unlinking functions to the
directory handle interface and corresponding run_as wrappers.
This allows the creation and unlinking of files relative to
an existing directory handle using either openat/unlinkat when
directory file descriptors are supported or open/unlink when
they are not.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 5 Mar 2019 03:16:10 +0000 (22:16 -0500)]
relayd: send sessiond uuid and session id as part of create session
Send the sessiond's instance UUID and session id as part of the
relay daemon control protocol's CREATE_SESSION command.
Those attributes will be used to uniquely identify trace chunks
in follow-up commits.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 14 Dec 2018 21:04:44 +0000 (16:04 -0500)]
Transmit sessiond uuid to consumerd on launch
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 12 Mar 2019 20:53:27 +0000 (16:53 -0400)]
Add lttng_uuid_copy() util
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 12 Mar 2019 20:53:00 +0000 (16:53 -0400)]
Add lttng_uuid_is_nil() util
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 11 Mar 2019 21:23:21 +0000 (17:23 -0400)]
Add lttng_uuid_is_equal util to lttng_uuid
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 12 Dec 2018 21:16:26 +0000 (16:16 -0500)]
Add a consumer daemon INIT command
This commit adds an INIT commands which allows the session daemon
to provide its UUID as soon as the consumer daemon is started.
The name of this command is generic since other attributes may
need to be passed at the initialization of a consumer daemon.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 12 Dec 2018 20:39:53 +0000 (15:39 -0500)]
Generate a UUID on lttng-sessiond launch
This commit adds a global sessiond_uuid which can be used to
uniquely identify a session daemon from a relay daemon's
perspective even when it communicates with multiple consumers.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 27 Feb 2019 17:16:29 +0000 (12:16 -0500)]
Remove unneeded creation of the UST domain sub-directory
ust_app_start_trace() always attempts to create its domain
sub-directory after the channel directory has been created. This is
redundant and can be safely removed.
To provide an example, a "domain sub-directory" is:
/home/jgalar/lttng-traces/allo-
20190227-115205/ust
A "channel sub-directory" is, in per-uid buffering mode:
/home/jgalar/lttng-traces/allo-
20190227-115205/ust/uid/1000/64-bit
or, in per-pid buffering mode:
/home/jgalar/lttng-traces/cloe_fafard-
20190227-115609/ust/pid/hello-ust-20186-
20190227-115700
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 6 May 2019 21:14:02 +0000 (17:14 -0400)]
.gitignore: ignore ccls and clangd files
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 26 Feb 2019 03:11:08 +0000 (22:11 -0500)]
Create an initial trace chunk on first start of an ltt_session
Add a current trace chunk to an ltt_session on session start.
The session base output directory is created at that moment and an
handle to it is provided to the session daemon's trace chunk when
it is set in 'owner' mode.
Setting the trace chunk in "owner" mode results in the creation of
the chunk's output directory. In the case, of the first chunk,
the chunk output directory matches the session output directory.
Hence, this has no visible effect.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sun, 5 May 2019 22:47:26 +0000 (18:47 -0400)]
Allow direct access to the dirfd of a directory handle
Serialization functions need access to the dirfd of a directory handle
in order to pass the fd and re-build the directory handle in
another process.
This function should not be used for other purposes. It is
also only available in the 'enable-dirfd' configuration, which
is assumed for the session daemon.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 21 Feb 2019 16:18:24 +0000 (11:18 -0500)]
Create a consumer daemon trace chunk registry on launch
A trace chunk registry is needed by the consumer daemon since there is
no concrete representation of a tracing session object in those
processes.
The trace chunk registry allows the consumer daemon to match
newly-created streams to their current trace chunk. This integration
is performed in a follow-up commit.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 19 Feb 2019 21:44:36 +0000 (16:44 -0500)]
Add the trace chunk and trace chunk registry interfaces
A trace chunk is a set of stream files. It maps to the user-visible
concept of "trace archive chunks" produced following a tracing session
rotation.
The concept of a "chunk" is introduced to make it possible to
associate a group of stream files together, store common
properties (e.g. the epoch, base path, list of files, credentials,
etc.), and perform an action once all files have been closed/released.
The "trace chunk" interface is to be used by the session, consumer,
and relay daemons in different ways, through the OWNER or USER roles.
The lttng_dynamic_pointer_array, lttng_dynamic_array, and optional
utils are added since they are used by the trace chunk implementation.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.051178 seconds and 5 git commands to generate.