Jonathan Rajotte [Thu, 5 Sep 2019 23:24:04 +0000 (19:24 -0400)]
Tests: metadata env scope values
The tests extract information from the metadata env scope of the trace
and reconstruct an lttng directory hierarchy to validate that the
information found in the metadata is correct.
Testing this way simulate a viewer that must reconstruct a lttng directory
hierarchy from metadata information only. This information is mostly there
for this purpose.
While there we validate the value of other env field when possible.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Thu, 5 Sep 2019 22:23:54 +0000 (18:23 -0400)]
Support LTTNG_KERNEL_SESSION_SET_CREATION_DATETIME of lttng-modules
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Thu, 5 Sep 2019 22:23:53 +0000 (18:23 -0400)]
Support LTTNG_KERNEL_SESSION_SET_NAME of lttng-modules
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Thu, 5 Sep 2019 22:23:52 +0000 (18:23 -0400)]
Metadata: add env fields to ease lttng path hierarchy creation for viewer
Add the following fields in the env section of the metadata:
- trace_name
The session name without datetime information.
Hence when the session is an auto-generated one, only print
LTTNG_DEFAULT_NAME.
- trace_creation_datetime:
The datetime at which the session was created.
We use session->creation time for it.
- tracer_buffering_scheme
The buffering scheme used. The value can be uid or pid.
- tracer_buffering_id
The key used by the buffering scheme (uid/pid).
- architecture_bit_width
The bit width of the computer architecture (e.g 32 or 64)
- vpid_datetime
The registration time of the vpid for per-pid mode.
Adding these fields ensure that the trace itself carry information that
is normally carried via folder hierarchy. e.g
test-
20190417-174951/ <- trace_name, trace_creation_datetime
└── ust <- domain
└── uid <- tracer_buffering_scheme
└── 1000 <- tracer_buffering_id
└── 64-bit <- architecture_bit_width
├── channel0_0
├── index
│ ├── channel0_0.idx
└── metadata
Per-pid buffering is quite similar.
auto-
20190722-174816 <- trace_name, trace_creation_datetime
└── ust <- domain
└── pid <- tracer_buffering_scheme
└── sample-ust-7640-
20190722-174818 <- procname, tracer_buffering_id, vpid_datetime
├── my-channel_0
├── index
│ ├── my-channel_0.idx
├── metadata
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Wed, 4 Sep 2019 22:30:00 +0000 (18:30 -0400)]
Fix: lttng_directory_handle_init fails on opening base relayd output
lttng_directory_handle_init, called from session_set_anonymous_chunk,
fails to open "$LTTNG_HOME/lttng-traces" directory as the folder is
not yet created at this time.
Rename init_session_output_directory_handle to
session_init_output_directory_handle and move it to session.h
For an anonymous chunk, the session->output_path is empty. The
resulting output directory handle is at the "root" node of the
lttng-relayd chosen output.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Wed, 4 Sep 2019 22:29:59 +0000 (18:29 -0400)]
Fix: init_session_output_path is valid for peer >= 2.11 only
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Wed, 4 Sep 2019 22:29:58 +0000 (18:29 -0400)]
Fix: chunk state is not set when relayd does not support trace chunks
Being explicit here enforces that for a lttng-relayd that does not
support chunks, the queried chunk will never exist.
This caused a lttng destroy command to hang during backward
compatibility testing with older lttng-relayd.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Wed, 28 Aug 2019 20:36:03 +0000 (16:36 -0400)]
Fix: check validity of a stream before invoking ust flush command
At the time ustctl_flush_buffer is called the ustream object might have
already been freed on lttng-ust side.
This can happen following a lttng_consumer_cleanup_relayd and concurrent
consumer flush command (lttng stop).
The chain of events goes as follows.
An error on communication with lttng-relayd occurs.
lttng_consumer_cleanup_relayd flags the streams for deletion
(CONSUMER_ENDPOINT_INACTIVE). validate_endpoint_status_data_stream calls
consumer_del_stream.
At the same time the hash table of streams is iterated over in the
flush_channel function following a stop command. The loop is iterating on
a given stream. The current thread is unscheduled before taking the stream
lock.
In the initial thread, the same stream is the current iteration of
cds_lfht_for_each_entry in validate_endpoint_status_data_stream.
consumer_del_stream is called on it. The stream lock is acquired, and
destroy_close_stream is called. lttng_ustconsumer_del_stream is eventually
called and at this point the ustream is freed.
Going back to the iteration in flush_channel. The current stream is still
valid from the point of view of the iteration, ustctl_flush_buffer is then
called on a freed ustream object.
This can lead to unknown behaviour since there is no validation on the
lttng-ust side. The underlying memory of the ustream object is garbage at
this point.
To prevent such scenario, we check for the presence of the node in the
hash table via cds_lfht_is_node_deleted while holding the stream lock.
This is valid because the stream destruction removes the node from
the hash table and frees the ustream object with the stream lock held.
This duplicate similar "validation" check of the stream object. [1][2]
[1] src/common/consumer/consumer.c:consumer_close_channel_streams
[2] src/common/ust-consumer/ust-consumer.c:close_metadata
This issue can be reproduced by the following scenario:
Modify flush_channel to sleep (i.e 10s) before acquiring the lock on
a stream.
Modify lttng-ust ustctl_destroy_stream to set the
ring_buffer_clock_read callback to NULL.
Note: An assert on !cds_lfht_is_node_deleted in flush channel
after acquiring the lock can provide the same information. We are
modifying the callback to simulate the original backtrace from our
customer.
lttng-relayd
lttng-sessiond
lttng create --live
lttng enable-event -u -a
lttng start
Start some applications to generate data.
lttng stop
The stop command force a flush of the channel/streams.
pkill -9 lttng-relayd
Expect assert or segfault
The original customer backtrace:
0 lib_ring_buffer_try_switch_slow (handle=<optimized out>, tsc=<synthetic pointer>, offsets=0x3fffa9b76c80, chan=0x3fff98006e90, buf=<optimized out>,
mode=<optimized out>) at /usr/src/debug/lttng-ust/2.9.1/git/libringbuffer/ring_buffer_frontend.c:1834
1 lib_ring_buffer_switch_slow (buf=0x3fff98016b40, mode=<optimized out>, handle=0x3fff98017670)
at /usr/src/debug/lttng-ust/2.9.1/git/libringbuffer/ring_buffer_frontend.c:1952
2 0x00003fffac680940 in ustctl_flush_buffer (stream=<optimized out>, producer_active=<optimized out>)
at /usr/src/debug/lttng-ust/2.9.1/git/liblttng-ust-ctl/ustctl.c:1568
3 0x0000000010031bc8 in flush_channel (chan_key=<optimized out>) at ust-consumer.c:772
4 lttng_ustconsumer_recv_cmd (ctx=<optimized out>, sock=<optimized out>, consumer_sockpoll=<optimized out>) at ust-consumer.c:1651
5 0x000000001000de50 in lttng_consumer_recv_cmd (ctx=<optimized out>, sock=<optimized out>, consumer_sockpoll=<optimized out>) at consumer.c:2011
6 0x0000000010014208 in consumer_thread_sessiond_poll (data=0x10079430) at consumer.c:3192
7 0x00003fffac608b30 in start_thread (arg=0x3fffa9b7bdb0) at pthread_create.c:462
8 0x00003fffac530d0c in .__clone () at ../sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S:96
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Mon, 3 Jun 2019 19:25:52 +0000 (15:25 -0400)]
Fix: namespace our gettid wrapper
Since glibc 2.30, a gettid wrapper was added that conflicts with our
static declaration. Namespace our wrapper so there is no conflict,
we'll add support for the glibc provided wrapper in a further commit.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 8 Aug 2019 14:49:23 +0000 (10:49 -0400)]
pprint.m4: add missing copyright header
Add the missing copyright header to pprint.m4, clarifying that it is
GPLv2+ with the special exception applying to Autoconf Macros.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Philippe Proulx <pproulx@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 23 May 2019 19:11:50 +0000 (15:11 -0400)]
Fix: reintroduce lazy kernel modules load, fix empty syscall list
Up and including to lttng 2.10, if the lttng-modules are not available
when the session daemon starts, an attempt is made to load them each
time a command attempts to interact with the kernel domain.
2.11-rc introduces a change in behavior which removes this lazy
initialization. This is an issue for distribution packaging (e.g.
Ubuntu) where there is no strong dependency between lttng-tools and
lttng-modules (because either are optional). So we can be unlucky and
find ourselves in a situation where the modules are not available when
the session daemon is launched at installation, but only afterwards.
Re-introduce the lazy kernel module load behavior, since this is
expected by users.
Also, fix an issue with empty syscall list in those lazy initialization
scenario by moving invocation of syscall_init_table() from main() to
init_kernel_tracer().
While we are there, cleanup the following in session daemon:
- move kernel_tracer_fd from globals.c to kernel.c. It becomes a static
variable,
- move module_proc_lttng from main.c to kernel.c,
- move init_kernel_tracer() from main.c to kernel.c,
- introduce kernel.c:cleanup_kernel_tracer(), invoke it from program
cleanup,
- introduce kernel_tracer_is_initialized() to check the state of
kernel tracer initialization,
- adapt kernel.c functions to use the static kernel_tracer_fd rather
than expect it as parameter,
- update syscall_init_table, invoked from kernel.c, to pass the
kernel_tracer_fd as parameter.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Wed, 22 May 2019 20:49:01 +0000 (16:49 -0400)]
Fix: check for lttng modules presence before testing
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 16 May 2019 19:08:52 +0000 (15:08 -0400)]
sessiond: use epoll()/poll() instead of select()
The select(2) system call is an ancient ABI limited to processes
containing at most FD_SETSIZE file descriptors overall (typically
1024).
This select call will fail if the target file descriptor is above
FD_SETSIZE in a session daemon containing many file descriptors.
This is unlikely to happen in normal use given than
sessiond_init_thread_quit_pipe() is called early by main(). Odd
scenarios could trigger this, for instance if the parent process leaves
a large number of file descriptors open, or if a library which
allocates file descriptors is LD_PRELOADed with the sessiond.
Never use select, use the lttng epoll/poll wrapper instead.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 16 May 2019 19:08:51 +0000 (15:08 -0400)]
lttng-ctl: notifications: use epoll()/poll() instead of select()
The select(2) system call is an ancient ABI limited to processes
containing at most FD_SETSIZE file descriptors overall (typically
1024).
Those notification APIs will fail if the target file descriptor
is above FD_SETSIZE in a process containing many file descriptors.
Never use select, use the lttng epoll/poll wrapper instead.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 16 May 2019 19:08:50 +0000 (15:08 -0400)]
epoll/poll compat: expose interruptible API
Some use of the epoll/poll wrapper require interruption
by signals to make the poll call return -1, errno EINTR.
Expose a new lttng_poll_wait_interruptible API for this
purpose.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 16 May 2019 19:08:01 +0000 (15:08 -0400)]
tests: invoke full_cleanup from script trap handlers, use modprobe -r
Scripts implementing their own trap handlers override the generic
one provided by utils.sh (full_cleanup). Invoke it at the end of
the handlers to provide the utils cleanup as well.
Moreover, change use of "rmmod" to "modprobe -r", which is better
in trap handlers because it does not print errors if the module
was not loaded yet when the signal occurs.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 16 May 2019 19:08:00 +0000 (15:08 -0400)]
Cleanup: test: don't stop relayd twice
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 16 May 2019 19:07:59 +0000 (15:07 -0400)]
Fix: test: utils.sh: exit from process on full_cleanup
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 16 May 2019 19:07:58 +0000 (15:07 -0400)]
Fix: utils.sh: handle SIGPIPE
perl prove closes its child pipes before giving it a chance to execute
the signal trap handler. This means the child will not be able to
complete execution of the trap handler if that handler writes to stdout
or stderr.
Work-around this situation by redirecting stdin, stdout, and stderr
to /dev/null if a SIGPIPE is caught.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 16 May 2019 19:07:57 +0000 (15:07 -0400)]
Fix: tests: error handling in high throughput limits test (v2)
Each individual call to "tc" should be checked for error, else we
may fail to catch specific tc errors caused, for instance, by a
kernel configuration that only contains some of the required
class modules.
Also, invoke the utils.sh full_cleanup function from the script-specific
interrupt_cleanup trap handler rather than try to perform stopping
of relayd and sessiond within the script.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 16 May 2019 19:07:56 +0000 (15:07 -0400)]
Improve handling of test SIGTERM/SIGINT (v2)
The current state of signal handling for test scripts is: on
SIGTERM/SIGINT of the tests (e.g. a CTRL-C on the console), session
daemon and relay daemon are killed with SIGKILL, thus leaking all their
resources, and leaving lttng kernel modules loaded.
Revamp the "stop" functions to take a signal number and a timeout
as optional parameters. The default signal number is SIGTERM.
The full_cleanup trap handler now tries to nicely kill relayd and
sessiond (if they are present) with SIGTERM, and wait up to the
user-configurable LTTNG_TEST_TEARDOWN_TIMEOUT environment variable
(which has a default of 60s). Then, if there are still either relayd,
sessiond, or consumerd present, it will SIGKILL them and wait for
them to vanish. If it had to kill sessiond with SIGKILL, it will
also explicitly try to unload the lttng modules with modprobe.
This approach is inspired from sysv init script shutdown behavior.
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, 5 Sep 2019 12:47:40 +0000 (08:47 -0400)]
Fix: incorrect conversion specifier used with size and padding
packet>size and padding_len, of type size_t, are logged using a
%PRIu64 specifier resulting in a warning being emitted on 32-bit
architectures.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 5 Sep 2019 12:42:40 +0000 (08:42 -0400)]
Fix: incorrect conversion specifier used with packet size
packet_size, of type size_t, is logged using a %PRIu64 specifier
resulting in a warning being emitted on 32-bit architectures.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 5 Sep 2019 00:22:20 +0000 (20:22 -0400)]
Fix: mismatch of ust_app_get_size_one_more_packet_per_stream prototype
The stub of ust_app_get_size_one_more_packet_per_stream() used when
building without lttng-ust support does not match the actual prototype
defined in ust-app.h. The ltt_ust_session pointer parameter must be
marked as const.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 5 Sep 2019 00:20:00 +0000 (20:20 -0400)]
Fix: mismatch of ust_app_snapshot_record prototype
The stub of ust_app_snapshot_record() used when building without
lttng-ust support does not match the actual prototype defined
in ust-app.h. The consumer_output pointer parameter must be
marked as const.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 4 Sep 2019 23:54:16 +0000 (19:54 -0400)]
Fix: lttcomm_consumer_close_trace_chunk_reply undefined without UST
lttcomm_consumer_close_trace_chunk_reply is not defined when
lttng-tools is build without lttng-ust support. Move its declaration
as part of the common section of sessiond-comm.h.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Sat, 24 Aug 2019 23:02:18 +0000 (16:02 -0700)]
Fix: kernel/ust snapshot backward compat for 2.10 relay
Ensure the snapshots are saved in the right subdirectory on older relay
daemons (2.10 and before).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Fri, 23 Aug 2019 00:59:49 +0000 (17:59 -0700)]
relayd protocol: reply path for close chunk and create session 2.11
Since the relay daemon is expected to be able to move the target
destination of the trace, reply the chunk and session path so session
can have relevant data rather than guessing their location.
The session daemon now use this information to send the path back to
the client for rotation and destroy commands, as well as for
rotation completion notifications.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Sun, 18 Aug 2019 18:53:33 +0000 (14:53 -0400)]
Fix: streaming and snapshot backward compat for relayd < 2.11
Fix backward compatibility of session daemon 2.11 with relayd versions
prior to 2.11.
Session daemon and consumer daemon 2.11 use the "chunk" object to
represent the current output directory. However, both sessiond and
consumerd need to ensure they do not send chunk and rotation commands
to a relayd older than 2.11, and tweak the stream paths accordingly.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 22 Aug 2019 17:06:22 +0000 (10:06 -0700)]
Fix: relayd: create_index_file error handling
Fix mixup between status and 0/-1 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 [Tue, 3 Sep 2019 22:20:01 +0000 (18:20 -0400)]
Fix: don't use newlines in logging message
Using explicit newlines ('\n') in a logging messages breaks the
logging output and makes it unnecessarily harder to read and parse the
LTTng daemons' logs.
Moreover, it is unnecessary to escape multi-line string literals.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 22 Aug 2019 00:36:29 +0000 (17:36 -0700)]
Fix: relayd outputs traces of legacy sessionds to home dir
The relay daemon's session output path creation fallback, which is
used when interacting with legacy (< 2.11) session daemons, does not
append the DEFAULT_TRACE_DIR_NAME to the user's home directory
(or LTTNG_HOME, if specified).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Sun, 18 Aug 2019 19:12:02 +0000 (15:12 -0400)]
relayd comm: add base path to create session
Add base path and session_name_contains_creation_time flag to
session creation 2.11 message.
Use it to ensure the "auto-<ts>" session names don't get
duplicate timestamps for their output paths.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 15 Aug 2019 19:34:48 +0000 (15:34 -0400)]
tests: add base-path tests
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 21 Aug 2019 23:24:39 +0000 (16:24 -0700)]
test utils: support URI in lttng_snapshot_add_output
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 15 Aug 2019 19:36:08 +0000 (15:36 -0400)]
Fix: close consumer sockets before waiting for them
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
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>
This page took 0.047896 seconds and 5 git commands to generate.