lttng-tools.git
5 years agobuild: include clear.h in dist stable-2.10-backport
Jonathan Rajotte [Thu, 11 Apr 2019 01:08:58 +0000 (21:08 -0400)] 
build: include clear.h in dist

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoTest: clear: local, streaming, live, tracefile rotation
Jonathan Rajotte [Mon, 8 Apr 2019 18:08:36 +0000 (14:08 -0400)] 
Test: clear: local, streaming, live, tracefile rotation

This is the base testsuite for the lttng clear command.

The following scenarios are validated:

    local
    local with tracefilei rotation
    streaming
    streaming with tracefile rotation
    live with viewer attach while clear is issued
    live with viewer attach after clear is issued
    live with viewer attach while clear is issued and tracefile rotation active

These tests are performed for kernel and userspace domain.

When testing in userspace the following scenarios are also tested:
     Per pid and clear: this should fail. It is not supported yet.
     relayd disallow clear: clear must fail when relayd does not allow it

For the test using a viewer a testpoint was added to lttng-relayd live
protocol to give a synchronization point between babeltrace and the test
script.

The common_test script is a bit convoluted due to the reuse of the same
script for both ust and kernel testing. The alternative is to have
almost the same code (90%) in two separate files.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoFix: out_fd can be uninitialized.
Jonathan Rajotte [Wed, 10 Apr 2019 20:11:30 +0000 (16:11 -0400)] 
Fix: out_fd can be uninitialized.

If out_fd is uninitialized return success.

This happens for snapshot stream for example.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoFix: leftover use of channel fd as identifier
Francis Deslauriers [Thu, 1 Mar 2018 22:03:52 +0000 (17:03 -0500)] 
Fix: leftover use of channel fd as identifier

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoPropagate error for clear command
Mathieu Desnoyers [Wed, 3 Apr 2019 21:47:20 +0000 (17:47 -0400)] 
Propagate error for clear command

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agosessiond: Implement clear for sessions with local and remote output
Mathieu Desnoyers [Wed, 3 Apr 2019 20:34:27 +0000 (16:34 -0400)] 
sessiond: Implement clear for sessions with local and remote output

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoconsumerd: Implement clear stream/session commands
Mathieu Desnoyers [Wed, 3 Apr 2019 20:32:21 +0000 (16:32 -0400)] 
consumerd: Implement clear stream/session commands

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agorelayd: Implement custom EfficiOS session clear
Mathieu Desnoyers [Wed, 3 Apr 2019 20:31:01 +0000 (16:31 -0400)] 
relayd: Implement custom EfficiOS session clear

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoindex common code: introduce lttng_index_file_unlink
Mathieu Desnoyers [Wed, 3 Apr 2019 20:29:44 +0000 (16:29 -0400)] 
index common code: introduce lttng_index_file_unlink

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: logging: log_add_time() save/restore errno
Mathieu Desnoyers [Tue, 2 Apr 2019 16:41:12 +0000 (12:41 -0400)] 
Fix: logging: log_add_time() save/restore errno

The debugging logging macros (e.g. DBG()) are used as printf in the
lttng-tools source files. The printf() implementation does not alter the
errno value, so the fact that log_add_time() (through clock_gettime())
can alter errno is unexpected. For instance, adding a logging statement
for debugging purposes within a function for which errno is expected to
stay unchanged on return will change the behavior between execution with
-vvv and non-verbose.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix relayd: initialize beacon to -1ULL
Mathieu Desnoyers [Tue, 2 Apr 2019 16:40:22 +0000 (12:40 -0400)] 
Fix relayd: initialize beacon to -1ULL

The relayd stream beacon_ts_end field is expected to have the value
-1ULL when unset (no beacon has been received since last index).

However, the initial state is wrong. It is left at the value 0, which
indicates that a live beacon has indeed been received (which is untrue),
which in turn causes a live beacon with ctf_stream_id of -1ULL to be
sent to babeltrace, which does not expect it, and fails.

This issue can be triggered with the following scenario:

1) create live session
2) setup UST per-uid buffers tracing
3) start tracing, without any active traced application
4) hook with babeltrace live client to view the trace
5) run a traced application

Step 5) will cause the babeltrace live client to receive a stream_id of
-1ULL, and error out.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: relayd: handling of lttng_read errors >= 0
Mathieu Desnoyers [Mon, 1 Apr 2019 19:46:25 +0000 (15:46 -0400)] 
Fix: relayd: handling of lttng_read errors >= 0

errno is only set when lttng_read returns a negative value. Else, we
need to print a ERR() statement rather than use PERROR().

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoUse free running metadata channel key between sessiond and kernel consumer
Francis Deslauriers [Fri, 2 Mar 2018 15:41:34 +0000 (10:41 -0500)] 
Use free running metadata channel key between sessiond and kernel consumer

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: use a free running channel key between sessiond and kernel consumer
Julien Desfossez [Thu, 30 Nov 2017 20:31:27 +0000 (15:31 -0500)] 
Fix: use a free running channel key between sessiond and kernel consumer

We currently use the channel FD number opened by the session daemon to
reference a channel in the consumer. This can lead to races where the
session daemon destroys a channel and recreates one with the same FD
number before the consumer has time to cleanup everything on its side,
so all the commands in between that use that FD number has a key may end
up working on the wrong objects.

This fix introduces a free running counter as the channel key, so this
decouples the channel key in the consumer from the channel FD in the
session daemon. This fixes the race observed in stress tests.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoRelayd: disallow-clear option parsing
Jonathan Rajotte [Mon, 11 Feb 2019 17:53:08 +0000 (12:53 -0500)] 
Relayd: disallow-clear option parsing

Parse LTTNG_RELAYD_DISALLOW_CLEAR env variable if present.
LTTNG_RELAYD_DISALLOW_CLEAR have priority on the command line argument.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoUpdate lttng_clear_session relevant error code return
Jonathan Rajotte [Mon, 11 Feb 2019 18:49:57 +0000 (13:49 -0500)] 
Update lttng_clear_session relevant error code return

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoUst-consumer: Add channel key to error msg on channel clear
Jonathan Rajotte [Mon, 11 Feb 2019 18:46:46 +0000 (13:46 -0500)] 
Ust-consumer: Add channel key to error msg on channel clear

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoDoc: lttng clear man page
Jonathan Rajotte [Mon, 11 Feb 2019 17:19:58 +0000 (12:19 -0500)] 
Doc: lttng clear man page

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoTest: mi for clear command
Jonathan Rajotte [Mon, 11 Feb 2019 16:45:27 +0000 (11:45 -0500)] 
Test: mi for clear command

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoFix: kernel metadata is generated on the fly for snapshot sessions
Jonathan Rajotte [Fri, 8 Feb 2019 02:30:11 +0000 (21:30 -0500)] 
Fix: kernel metadata is generated on the fly for snapshot sessions

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoTest: clear: take an additional snapshot after clear for per-pid
Jonathan Rajotte [Thu, 14 Feb 2019 19:33:51 +0000 (14:33 -0500)] 
Test: clear: take an additional snapshot after clear for per-pid

Use the before-exit sync points of gen-ust-event to prevent the app from
exiting and generate a single event to test that tracing functionality still
works.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoTest: lttng clear command for snapshot session
Jonathan Rajotte [Thu, 14 Feb 2019 02:33:35 +0000 (21:33 -0500)] 
Test: lttng clear command for snapshot session

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoGen-ust-events: add touch and wait sync points before exit.
Jonathan Rajotte [Thu, 14 Feb 2019 02:22:06 +0000 (21:22 -0500)] 
Gen-ust-events: add touch and wait sync points before exit.

Allows an app to linger until the wait file is created and signals that
the app is just before the exit.

This is mostly useful for per-pid tracing where trace buffers are
cleaned on application teardown.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoGen-ust-events: add sync point before last event
Jonathan Rajotte [Thu, 14 Feb 2019 02:40:54 +0000 (21:40 -0500)] 
Gen-ust-events: add sync point before last event

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoGen-ust-events: use options instead of arguments
Jonathan Rajotte [Thu, 14 Feb 2019 02:37:56 +0000 (21:37 -0500)] 
Gen-ust-events: use options instead of arguments

Remove argument dependency and ease usage of feature individually.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoCLI: Implement lttng clear session command
Jonathan Rajotte [Mon, 11 Feb 2019 16:26:05 +0000 (11:26 -0500)] 
CLI: Implement lttng clear session command

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoLttng-ctl: Expose sessiond cmd_clear_session command
Jonathan Rajotte [Mon, 11 Feb 2019 16:24:38 +0000 (11:24 -0500)] 
Lttng-ctl: Expose sessiond cmd_clear_session command

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoSessiond: Implement cmd_clear_session
Jonathan Rajotte [Mon, 11 Feb 2019 16:18:22 +0000 (11:18 -0500)] 
Sessiond: Implement cmd_clear_session

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoConsumer: implement LTTNG_CONSUMER_CLEAR_CHANNEL
Jonathan Rajotte [Mon, 11 Feb 2019 15:24:35 +0000 (10:24 -0500)] 
Consumer: implement LTTNG_CONSUMER_CLEAR_CHANNEL

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoConsumer: Implement lttng_consumer_clear_channel
Jonathan Rajotte [Fri, 8 Feb 2019 22:05:10 +0000 (17:05 -0500)] 
Consumer: Implement lttng_consumer_clear_channel

This function is responsible for performing all actions needed to
clear a given channel.

It only supports clear operation on unmonitored channel
(snapshot mode) for now.

To do so, flush and clear all the channel streams.

We use an active flush (consumer_flush_buffer(..., 1)) since we consider
the producer active at all time. No reason so far to check for the
quiescent state of the channel. This might need to be revisited.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoUst consumer: Expose userspace clear buffer operation
Jonathan Rajotte [Tue, 12 Feb 2019 15:57:41 +0000 (10:57 -0500)] 
Ust consumer: Expose userspace clear buffer operation

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoKernel-ctl: Expose kernel clear buffer operation
Jonathan Rajotte [Tue, 12 Feb 2019 15:57:18 +0000 (10:57 -0500)] 
Kernel-ctl: Expose kernel clear buffer operation

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoBackport: Tests: use modprobe to test for the presence of lttng-modules
Jonathan Rajotte [Wed, 28 Mar 2018 19:21:26 +0000 (15:21 -0400)] 
Backport: Tests: use modprobe to test for the presence of lttng-modules

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: create_lttng_session_uri from 308a89467c4dbfe218a9665bab82555dd88c07c9
Jonathan Rajotte [Thu, 28 Jun 2018 14:38:19 +0000 (10:38 -0400)] 
Backport: create_lttng_session_uri from 308a89467c4dbfe218a9665bab82555dd88c07c9

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoRemove duplicate check for dlopen
Michael Jeanson [Thu, 20 Dec 2018 21:16:47 +0000 (16:16 -0500)] 
Remove duplicate check for dlopen

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoTests: take multiple snapshots in streaming mode
Jonathan Rajotte [Fri, 8 Feb 2019 01:25:41 +0000 (20:25 -0500)] 
Tests: take multiple snapshots in streaming mode

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: don't destroy the sockets if the snapshot was successful
Jonathan Rajotte [Fri, 8 Feb 2019 01:25:42 +0000 (20:25 -0500)] 
Fix: don't destroy the sockets if the snapshot was successful

Missing a goto to skip the error condition that was destroying the
relayd sockets even if a snapshot was successful. We want to keep them
open to reuse them for the next snapshots.

This is verbatim from the fix 1371fc1228461eb532118280e67ab3e9de015757

It is also the same fix.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: missing rcu read locking in trigger "unregister all" command
Jérémie Galarneau [Wed, 23 Jan 2019 20:29:14 +0000 (15:29 -0500)] 
Fix: missing rcu read locking in trigger "unregister all" command

While the notification subsystem all runs within a single thread,
the iteration over the triggers hash table must be protected using
the RCU read-side lock since the RCU worker may resize the hash
table while the iteration is performed.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: notification thread: RCU-safe reclaim of hash table nodes
Jérémie Galarneau [Wed, 23 Jan 2019 20:28:36 +0000 (15:28 -0500)] 
Fix: notification thread: RCU-safe reclaim of hash table nodes

Adapted from master branch commit 83b934ad.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoUpdate version to v2.10.6
Jérémie Galarneau [Tue, 22 Jan 2019 18:55:01 +0000 (13:55 -0500)] 
Update version to v2.10.6

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: worker structure is leaked in run_as process
Jérémie Galarneau [Thu, 6 Dec 2018 20:49:04 +0000 (15:49 -0500)] 
Fix: worker structure is leaked in run_as process

The run_as structure (handle) is allocated and initialized before
the fork() that spawns the run_as process. Currently, that structure
is only cleaned-up on the parent's end.

This fix performs the clean-up on the worker's side as well.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: only free trace_path when it is dynamically allocated
Jérémie Galarneau [Mon, 14 Jan 2019 22:13:32 +0000 (17:13 -0500)] 
Fix: only free trace_path when it is dynamically allocated

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: leak of filter bytecode and expression on agent event re-enable
Jérémie Galarneau [Sat, 12 Jan 2019 19:53:56 +0000 (14:53 -0500)] 
Fix: leak of filter bytecode and expression on agent event re-enable

The agent subsystem does not properly assume the clean-up of an
event's filter bytecode and expression when a previously disabled
event is re-enabled.

This change ensures that the ownership of both the filter bytecode
and expression is assumed by the agent subsystem and discarded
when a matching event is found.

Steps to reproduce the leak:
$ lttng create
$ lttng enable-event --python allo --filter 'a[42] == 241'
$ lttng disable-event --python allo
$ lttng enable-event --python allo --filter 'a[42] == 241'

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoTest fix: python logging test spams its output
Jérémie Galarneau [Sat, 12 Jan 2019 19:21:24 +0000 (14:21 -0500)] 
Test fix: python logging test spams its output

A set -x/+x pair was erroneously committed as part of the
test_python_logging test script which causes the test to be
unnecessarily verbose.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: leak of rundir config string
Jérémie Galarneau [Fri, 11 Jan 2019 20:10:08 +0000 (15:10 -0500)] 
Fix: leak of rundir config string

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: do not repurpose iterator while it is being used
Mathieu Desnoyers [Wed, 12 Dec 2018 22:37:54 +0000 (17:37 -0500)] 
Fix: do not repurpose iterator while it is being used

The hash table iteration uses an iterator that needs to stay valid for
the next loop. Using that same iterator variable in a nested lookup in a
different hash table leads to segmentation fault.

This is a 2.10-specific instance of the issue affecting
bind_trigger_to_matching_channels() which was found in the
master and 2.11 branches. This one affects
handle_notification_thread_command_register_trigger().

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: run_command_wait() handle partial write
Mathieu Desnoyers [Thu, 13 Dec 2018 18:56:35 +0000 (13:56 -0500)] 
Fix: run_command_wait() handle partial write

Use lttng_write() to handle partial writes (writing less than the
requested amount of bytes) as well as ret = -1, errno = EINTR.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: tests: test_crash should start sessions
Mathieu Desnoyers [Fri, 16 Nov 2018 18:25:00 +0000 (13:25 -0500)] 
Fix: tests: test_crash should start sessions

test_crash expects side-effects of directory creation to happen while
tracing is still stopped. In preparation for changing that behavior,
ensure that tracing is started when those side-effects are expected.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoAdd *.exe to gitignore for Cygwin
Michael Jeanson [Tue, 27 Nov 2018 19:24:27 +0000 (14:24 -0500)] 
Add *.exe to gitignore for Cygwin

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: warning 'fd' may be used uninitialized
Michael Jeanson [Thu, 29 Nov 2018 21:49:51 +0000 (16:49 -0500)] 
Fix: warning 'fd' may be used uninitialized

Initialize fd to invalid '-1' and remove unnecessary file_opened.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: max_t/min_t macros are missing cast on input
Mathieu Desnoyers [Tue, 13 Nov 2018 17:12:21 +0000 (12:12 -0500)] 
Fix: max_t/min_t macros are missing cast on input

The semantic expected from max_t and min_t is to perform the max/min
comparison in the type provided as first parameter.

Cast the input parameters to the proper type before comparing them,
rather than after. There is no more need to cast the result of the
expression now that both inputs are cast to the right type.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: Connect timeout arithmetic in inet/inet6 (v4)
Mathieu Desnoyers [Tue, 13 Nov 2018 17:12:20 +0000 (12:12 -0500)] 
Fix: Connect timeout arithmetic in inet/inet6 (v4)

The nanoseconds part of the timespec struct time_a is not always
bigger than time_b since it wraps around each second.

Use 64-bit arithmetic to compute the difference.

Merge/move duplicated code into utils.c.

This function is really doing two things. Split it into
timespec_to_ms() and timespec_abs_diff().

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: create_channel_per_pid: remove channel on error
Mathieu Desnoyers [Wed, 14 Nov 2018 22:49:21 +0000 (17:49 -0500)] 
Fix: create_channel_per_pid: remove channel on error

The notification system of the session daemon tracks the lifetime
of per-pid buffers (in effect, channel keys) using two hooks:
  - the successful completion of create_channel_per_pid()
  - the deletion of the channel from an application's registry

Multiple error paths in create_channel_per_pid() can leave a channel
in an app's registry without notifying the notification system of its
existence.

When the channel is finally cleaned-up, the channel deletion hook will
inform the notification system that the channel should be deleted,
resulting in an error as that channel was previously unknown.

This fix ensures we remove the application's channel from its registry
on error (with the notify parameter set to 'false'), thus ensuring
that the notification system never tracks the incomplete channel.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: channel errors on local stress-tests
Mathieu Desnoyers [Wed, 14 Nov 2018 22:46:26 +0000 (17:46 -0500)] 
Fix: channel errors on local stress-tests

On local stress-tests with per-pid buffers, error paths triggered
when trying to create a channel on an application already going away
end up tiggering the channel destruction with "-1" socket parameter.
This function attempts to send a notification of channel destruction
(erroneously) and attempts to sum counters into a channel object which
may not have been populated yet.

Therefore, don't perform those side-effects when invoked from error path
caused by channel creation error.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: channel_ust_create: remove channel on agent error
Mathieu Desnoyers [Wed, 14 Nov 2018 22:45:38 +0000 (17:45 -0500)] 
Fix: channel_ust_create: remove channel on agent error

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoAlways choose large event header for UST channels
Mathieu Desnoyers [Wed, 17 Oct 2018 21:16:12 +0000 (17:16 -0400)] 
Always choose large event header for UST channels

UST can receive the session start command before all probe provider
library constructors have completed running, therefore finding less
events than eventually enabled within the process. Moreover, with
per-uid buffers, many processes end up registering events into shared
buffers. Therefore, the guess based on number of events from the first
process to use the buffer is incorrect.

Considering that we typically have applications with more than 30
events, we will modify the session daemon so it selects the "large"
header type independently of the number of events.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoRemove unnecessary check of output parameter
Jérémie Galarneau [Fri, 5 Oct 2018 16:06:37 +0000 (12:06 -0400)] 
Remove unnecessary check of output parameter

It is not necessary to check for `_notification != NULL` as it
is done at the beginning of the function. Moreover, it confuses
Coverity which warns that `notification` will be leaked if the
output parameter is NULL.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: perform local data pending before checking data pending with relayd
Jonathan Rajotte [Tue, 11 Sep 2018 00:09:15 +0000 (20:09 -0400)] 
Fix: perform local data pending before checking data pending with relayd

Performing the data pending check in two phases, local and network,
reduces the total number network operations needed.

Doing the local check first enable early return in cases where data is
still pending locally.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: double put on error path
Jonathan Rajotte [Tue, 11 Sep 2018 00:09:11 +0000 (20:09 -0400)] 
Fix: double put on error path

Let relay_index_try_flush be responsible for the self-reference put on
error path.

Code flow of relay_index_try_flush is a bit tricky but the only error
flow (via relay_index_file_write) will always mark the index as flushed
and perform the self-reference put.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: holding the stream lock does not equate to having data pending
Jonathan Rajotte [Tue, 11 Sep 2018 00:09:14 +0000 (20:09 -0400)] 
Fix: holding the stream lock does not equate to having data pending

The live timer can hold the stream lock while sending empty beacon. An
empty beacon does not mean that data is still pending for the stream.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: skip uid registry when metadata key is 0
Jonathan Rajotte [Tue, 11 Sep 2018 00:09:13 +0000 (20:09 -0400)] 
Fix: skip uid registry when metadata key is 0

A value of zero for the metadata key indicate that metadata was never
created/pushed to the consumer.

This can occur in scenario were a tracker is present since metadata
might never be created/pushed.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoDocs: document the meaning of a ust app channel key set to 0
Jérémie Galarneau [Mon, 17 Sep 2018 22:15:11 +0000 (18:15 -0400)] 
Docs: document the meaning of a ust app channel key set to 0

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: acquire stream lock during kernel metadata snapshot
Jérémie Galarneau [Tue, 11 Sep 2018 00:09:12 +0000 (20:09 -0400)] 
Fix: acquire stream lock during kernel metadata snapshot

The stream lock is not taken when interacting with the kernel
metadata stream that is created at the time a snapshot is taken.

This was noticed while reviewing the code for an unrelated reason,
so there is no known problem caused by this. Nevertheless, this
is incorrect as the stream is globally visible in the consumer.

Moreover, the stream was not cleaned-up which can cause a leak
whenever a metadata snapshot fails.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoFix: skip closed session on viewer listing
Jonathan Rajotte [Fri, 7 Sep 2018 19:18:38 +0000 (15:18 -0400)] 
Fix: skip closed session on viewer listing

There is  no value in listing  a closed session. A  viewer cannot hook
itself to a closed session in live mode and the session is about to be
removed from the sessions hash table.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: use LTTNG_VIEWER_ATTACH_UNK to report a closed session
Jonathan Rajotte [Fri, 7 Sep 2018 19:18:37 +0000 (15:18 -0400)] 
Fix: use LTTNG_VIEWER_ATTACH_UNK to report a closed session

LTTNG_VIEWER_NEW_STREAMS_HUP is not a valid error number for the
LTTNG_VIEWER_ATTACH_SESSION command. This result in erroneous error
reporting on the client side.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoDoc: withinin -> within
Jonathan Rajotte [Mon, 17 Sep 2018 16:19:40 +0000 (12:19 -0400)] 
Doc: withinin -> within

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: perform relayd socket pair cleanup on control socket error
Jonathan Rajotte [Wed, 6 Jun 2018 01:00:28 +0000 (21:00 -0400)] 
Fix: perform relayd socket pair cleanup on control socket error

A reference to the local context for the socket pair is used to "force" an
evaluation of the data and metadata streams since we changed the endpoint
status. This imitates what is currently done for the data socket.

This prevents hitting network timeouts multiple times in a row when an
error occurs. For now, there is no mechanism for retry hence
"terminating" all communication make sense and prevent unwanted delays
on operation.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: relayd control socket mutex is not destroyed
Jérémie Galarneau [Thu, 13 Sep 2018 21:04:45 +0000 (17:04 -0400)] 
Fix: relayd control socket mutex is not destroyed

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoTests: do not bound test app iterations when in background mode
Jonathan Rajotte [Tue, 3 Jul 2018 18:49:23 +0000 (14:49 -0400)] 
Tests: do not bound test app iterations when in background mode

On systems with a high number of CPUs and slow disk, taking snapshots
can take a long time. When running a long regression test, the tests
sometimes outlive the test application.

The test application then exits since the required number of
iterations was completed
(NR_ITER=2000000).

Set the iterations parameter to -1 to ensure the application keeps
producing events for the duration of the test.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoTests: add missing rotation and autoload tests to check target
Jérémie Galarneau [Tue, 11 Sep 2018 19:11:39 +0000 (15:11 -0400)] 
Tests: add missing rotation and autoload tests to check target

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoTests: remove temporary folder
Jonathan Rajotte [Tue, 5 Jul 2016 19:23:42 +0000 (15:23 -0400)] 
Tests: remove temporary folder

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoTests: remove mi result files when done
Jonathan Rajotte [Tue, 5 Jul 2016 18:38:46 +0000 (14:38 -0400)] 
Tests: remove mi result files when done

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoTests: Remove unused set +x
Jonathan Rajotte [Wed, 14 Oct 2015 13:57:42 +0000 (09:57 -0400)] 
Tests: Remove unused set +x

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoTests: Kill relayd after sessiond to ensure a clean tear down
Jonathan Rajotte [Tue, 6 Oct 2015 21:10:56 +0000 (17:10 -0400)] 
Tests: Kill relayd after sessiond to ensure a clean tear down

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoTests: Remove unused variable
Jonathan Rajotte [Tue, 6 Oct 2015 16:07:41 +0000 (12:07 -0400)] 
Tests: Remove unused variable

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoTests: Use stop relayd from utils.sh
Jonathan Rajotte [Wed, 30 Sep 2015 22:41:30 +0000 (18:41 -0400)] 
Tests: Use stop relayd from utils.sh

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoTests: remove declaration already present in utils.sh
Jonathan Rajotte [Wed, 30 Sep 2015 22:38:13 +0000 (18:38 -0400)] 
Tests: remove declaration already present in utils.sh

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: incorrect error message on regenerate missing argument
Jérémie Galarneau [Thu, 30 Aug 2018 18:49:29 +0000 (14:49 -0400)] 
Fix: incorrect error message on regenerate missing argument

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: incorrect error message on metadata missing argument
Jérémie Galarneau [Thu, 30 Aug 2018 18:45:23 +0000 (14:45 -0400)] 
Fix: incorrect error message on metadata missing argument

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: snapshot command mishandles missing arguments
Jérémie Galarneau [Thu, 30 Aug 2018 18:32:10 +0000 (14:32 -0400)] 
Fix: snapshot command mishandles missing arguments

The snapshot command does not print explicit errors when
arguments are missing. This commit introduces more error
reporting and ensures that lttng_error_code and cmd_error_code
values are not freely mixed.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: potential use of NULL path in stat() use
Jérémie Galarneau [Thu, 30 Aug 2018 17:36:37 +0000 (13:36 -0400)] 
Fix: potential use of NULL path in stat() use

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: passing null to closedir() on error
Jérémie Galarneau [Wed, 29 Aug 2018 21:28:36 +0000 (17:28 -0400)] 
Fix: passing null to closedir() on error

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: unchecked access to pids array
Jérémie Galarneau [Wed, 29 Aug 2018 21:25:04 +0000 (17:25 -0400)] 
Fix: unchecked access to pids array

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: returned pids may be uninitialized
Jérémie Galarneau [Wed, 29 Aug 2018 20:56:52 +0000 (16:56 -0400)] 
Fix: returned pids may be uninitialized

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: lttng-save command producing wrong XML fields
Francis Deslauriers [Thu, 5 Jul 2018 22:14:54 +0000 (18:14 -0400)] 
Fix: lttng-save command producing wrong XML fields

Saving a session configuration with a probe or a function event would
generate a XML file considered invalid by the lttng-load command.

This is due to the fact that for a probe event lttng-save would the
following xml event type field:
  <type>KPROBE</type>
but lttng-load command would be expecting the following field:
  <type>PROBE</type>.

As a fix, the lttng-save command now rightfully outputs the PROBE field.
Given that this usecase never worked, changing the field is not a
breaking change.

Also, the save command was wrongfully using FUNCTION xml event type for
the LTTNG_KERNEL_FUNCTION event type when it is in fact the
FUNCTION_ENTRY xml event type.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: memory is not zeroed on first set_capacity
Jérémie Galarneau [Tue, 17 Oct 2017 21:22:02 +0000 (17:22 -0400)] 
Fix: memory is not zeroed on first set_capacity

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: dynamic buffer mishandles setting capacity to 0
Jérémie Galarneau [Tue, 17 Oct 2017 03:48:21 +0000 (23:48 -0400)] 
Fix: dynamic buffer mishandles setting capacity to 0

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: client_list_element leak on failure to evaluate a condition
Jérémie Galarneau [Mon, 20 Aug 2018 21:14:06 +0000 (17:14 -0400)] 
Fix: client_list_element leak on failure to evaluate a condition

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: possible NULL dereference in uri_parse_str_urls()
Jérémie Galarneau [Mon, 20 Aug 2018 20:45:09 +0000 (16:45 -0400)] 
Fix: possible NULL dereference in uri_parse_str_urls()

The data_url parsing of uri_parse_str_urls assumes that a ctrl
URL was provided to check that both URLs point to the same
destination. A check for 'ctrl_uris != NULL' is added, but this
function needs to be refactored at some point at it is not clear
what its role is (i.e. it's probably doing too much).

Reported-by: Coverity Scan (1378214 Explicit null dereferenced)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: clean-up sessiond condig structure on initialization error
Jérémie Galarneau [Mon, 20 Aug 2018 19:50:48 +0000 (15:50 -0400)] 
Fix: clean-up sessiond condig structure on initialization error

The sessiond configuration structure's initialization may fail,
leaving some fields allocated and others to NULL. On error, the
structure should be cleaned-up to prevent a leak.

This allows the rest of the code to assume that all configuration
options are not NULL.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: unchecked return value in sessiond path configuration
Jérémie Galarneau [Mon, 20 Aug 2018 19:22:53 +0000 (15:22 -0400)] 
Fix: unchecked return value in sessiond path configuration

The return values of the functions setting the sessiond's
base paths are not checked.

Reported-by: Coverity Scan (1382768 and 1382769, Unused value)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoSet consumer's verbosity to the max level on --verbose-consumer
Jérémie Galarneau [Fri, 20 Jul 2018 22:41:49 +0000 (18:41 -0400)] 
Set consumer's verbosity to the max level on --verbose-consumer

The consumer's verbosity is set to '1' when --verbose-consumer
is used when launching the session daemon. This means that all
DBG2/3() statements are ignored.

This commit always sets the consumer's verbosity to the maximal
level.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoTests: added test_autoload to noinst_SCRIPTS
Anders Wallin [Thu, 26 Jul 2018 07:46:28 +0000 (09:46 +0200)] 
Tests: added test_autoload to noinst_SCRIPTS

Signed-off-by: Anders Wallin <wallinux@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoUpdate version to v2.10.5
Jérémie Galarneau [Tue, 24 Jul 2018 00:19:57 +0000 (20:19 -0400)] 
Update version to v2.10.5

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: missing context enum values in session xml schema
Francis Deslauriers [Tue, 5 Jun 2018 14:57:48 +0000 (10:57 -0400)] 
Fix: missing context enum values in session xml schema

    Handling of the following enum are added:
        LTTNG_EVENT_CONTEXT_INTERRUPTIBLE
        LTTNG_EVENT_CONTEXT_PREEMPTIBLE
        LTTNG_EVENT_CONTEXT_NEED_RESCHEDULE
        LTTNG_EVENT_CONTEXT_MIGRATABLE

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoTests: add session auto-loading test cases
Anders Wallin [Thu, 17 May 2018 20:50:41 +0000 (22:50 +0200)] 
Tests: add session auto-loading test cases

lttng-sessiond can auto load sessions at startup;
- with "--load" option to lttng-sessiond, load one file
  or all sessions files in that directory
- from session files in $LTTNG_HOME/.lttng/sessions/auto/
- from session files in $sysconfdir/lttng/sessions/auto

This test case validates the two first scenarios.

Signed-off-by: Anders Wallin <wallinux@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBash completion: ignore namespace for xmllint parsing
Jonathan Rajotte [Mon, 28 May 2018 21:31:48 +0000 (17:31 -0400)] 
Bash completion: ignore namespace for xmllint parsing

xmllint cli does not "easily" support namespace.

One can use the local_name() xpath function and other "trick".
The simplest trick for bash completion is to ignore the namespace
altogether.

Replacing "xmlns" by "ignore" does the job.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoTypo in ust consumer log message (channek -> channel)
Jérémie Galarneau [Mon, 4 Jun 2018 21:28:56 +0000 (17:28 -0400)] 
Typo in ust consumer log message (channek -> channel)

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: use signed variable for refcounting of consumer_relayd_sock_pair
Jonathan Rajotte [Wed, 14 Mar 2018 18:54:21 +0000 (14:54 -0400)] 
Fix: use signed variable for refcounting of consumer_relayd_sock_pair

Otherwise refcount check after decreasing have no meaning as in
consumer_stream_relayd_close function.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: warning due to hash_key_str() being not const-correct
Jérémie Galarneau [Wed, 30 May 2018 22:09:19 +0000 (18:09 -0400)] 
Fix: warning due to hash_key_str() being not const-correct

Hash table utils do not enforce const-correct in lttng-tools prior
to 2.11. This results in a warning when pasing a const argument
to those utilities.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.044107 seconds and 5 git commands to generate.