lttng-tools.git
6 years agoDocs: describe the apps_thread's working in function header
Jérémie Galarneau [Wed, 13 Dec 2017 23:24:10 +0000 (18:24 -0500)] 
Docs: describe the apps_thread's working in function header

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTests: race between consumer pause and trace start/stop
Jérémie Galarneau [Sat, 9 Dec 2017 17:51:46 +0000 (12:51 -0500)] 
Tests: race between consumer pause and trace start/stop

This fixes two problems with the current test.

1. Starting the tracing before pausing the consumption can result
in an arbitrary number of buffer usage conditions being sent to
the client as the buffers can be filled and emptied a number of
times.

2. Resuming the consumption before stopping tracing can, in a
similar way as '1', result in an arbitrary number of notifications
being sent to the client.

Note that the non-blocking stop is used since the blocking
variant would wait for pending data to be flushed forever since
the consumption is paused. Hence, we stop the tracing, resume
the consumption, and wait for the buffers to be flushed explicitly
using the lttng_data_pending() call. No sleeps are performed in
that loop since those could hide races triggered by this test.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoClean-up: remove unneeded rcu_read_lock acquisition
Jérémie Galarneau [Tue, 5 Dec 2017 20:22:11 +0000 (15:22 -0500)] 
Clean-up: remove unneeded rcu_read_lock acquisition

create_channel_per_uid() must already be called while the
RCU reader lock is held since the buffer registry is being
accessed.

The only caller of create_channel_per_uid() is do_create_channel()
which, itself, documents that it must be called while holding the
RCU read lock.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoDocs: document locking assumption of function
Jérémie Galarneau [Tue, 5 Dec 2017 20:21:49 +0000 (15:21 -0500)] 
Docs: document locking assumption of function

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: notification thread not notified of channel creation on app error
Jérémie Galarneau [Tue, 5 Dec 2017 20:25:28 +0000 (15:25 -0500)] 
Fix: notification thread not notified of channel creation on app error

The multi-app notification test is failing (more often on ARM64)
since the notification thread appears to not be notified of a
channel's creation under some circumstances.

Investigating this failure pointed to create_channel_per_uid()
which provides the "hook" the notification system needs to
be informed of a channel's creation.

The first time this function is invoked for a given channel, the
lookup in the buffer registry will fail, prompting the lazy creation
of the channel. Then, that channel is sent to the application
being registered.

The error in the current code is that the channel's creation
is not communicated to the notification subsystem whenever the
session daemon fails to communicate with the application.

Failing to communicate with the application is not a channel
creation error (in per-uid mode). In this specific case, the
test is launching many short-lived applications and it is
expected for the session daemon to encounter closing or dead
applications as it handles their registration.

Note that the diff of this commit is misleading. The important part
is that notification_thread_command_add_channel() has to be
performed regardless of the result of send_channel_uid_to_ust().

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoClean-up: consumer_add_metadata_stream always returns 0
Jonathan Rajotte [Thu, 28 Sep 2017 20:37:22 +0000 (16:37 -0400)] 
Clean-up: consumer_add_metadata_stream always returns 0

Since c869f647b0c4476645ab9ee01e362401fb8c1e42, the return value of
consumer_add_metadata_stream is always zero. Hence, we can remove some
dead error handling code.

consumer_add_metadata_stream success is checked using asserts.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: scope ownership of a stream for ust-consumer
Jonathan Rajotte [Thu, 28 Sep 2017 20:37:21 +0000 (16:37 -0400)] 
Fix: scope ownership of a stream for ust-consumer

A failure on lttng_pipe_write() during send_stream_to_thread() leads to
a null-pointer dereference of the stream handle during
consumer_del_channel(). The chain of events leading to the problem
is:

 - Failure during lttng_pipe_write() inside send_stream_to_thread().

 - Call to consumer_stream_destroy() via consumer_del_stream_for_data()
   or consumer_del_stream_for_metadata().

 - The stream is monitor and globally visible at this point leading to
   performing a call to destroy_close_stream() which performs the first
   cleanup of the stream.

   Note: At this point the stream is still in the channel local stream
         list (stream.send_node).

 - The call to unref_channel() returns a reference to a channel for which
   a cleanup call must be done.

 - The cleanup call for the channel is performed using
   consumer_del_channel().

 - At this point the stream is still in the channel's local stream list.
   This results in a second call to consumer_stream_destroy() via
   clean_channel_stream_list(). Which, itself, results in accesses to
   freed memory.

The fix consists in:

 - Using cds_list_del() inside send_stream_to_thread() after public
   exposition of the stream to ensure that the stream ownership/visibility
   is clear. A stream cannot be globally visible and local
   (stream.send_node) to a channel at the same time.
 - Modifying error paths to acknowledge the ownership transfer to
   send_stream_to_thread().

Reported-by: Liguang Li <liguang.li@windriver.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoClean-up: reduce scope of dyanamically-allocated string
Jérémie Galarneau [Thu, 30 Nov 2017 23:23:44 +0000 (00:23 +0100)] 
Clean-up: reduce scope of dyanamically-allocated string

tmpnew is only useful within the scope of the libdir check.
It can be allocated and free()'d within that scope.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: using putenv() and free()-ing the value is invalid
Jérémie Galarneau [Thu, 30 Nov 2017 23:18:03 +0000 (00:18 +0100)] 
Fix: using putenv() and free()-ing the value is invalid

putenv() does not copy the string passed as the parameter. Hence,
free()-ing the string results in an invalid environment. In the
"good" case, we don't care since we execl().

However, on error, our process now has an invalid environment
which can cause breakage further down the line.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoClean-up: unnecessary duplicated call to exit()
Jérémie Galarneau [Thu, 30 Nov 2017 22:50:16 +0000 (23:50 +0100)] 
Clean-up: unnecessary duplicated call to exit()

exit(EXIT_FAILURE) is called outside of the switch case.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: unknown consumer type considered a libc error
Jérémie Galarneau [Thu, 30 Nov 2017 22:45:30 +0000 (23:45 +0100)] 
Fix: unknown consumer type considered a libc error

The PERROR() macro uses the errno variable to print an error
message. However, the consumer type being invalid is an internal
error. The value of errno, at that point, is unrelated to the
error.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: consumerd(64/32)_lib_dir can be NULL
Jonathan Rajotte [Wed, 29 Nov 2017 21:42:29 +0000 (16:42 -0500)] 
Fix: consumerd(64/32)_lib_dir can be NULL

Reproducer:
lttng-sessiond \
    --consumerd32-path=/usr/local/lib/lttng/libexec/lttng-consumerd \
    --consumerd64-path=/usr/local/lib/lttng/libexec/lttng-consumerd

lttng create
lttng enable-event -u -a

On a 64bit machine the invocation of the 64bit consumerd will not fail
since its libdir is populated by sessiond_config_init but will segfault on
spawning of the 32 bit consumerd when performing the check of libdir
value.

On a 32bit machine the opposite will happen.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: evaluate trigger condition on registration
Jérémie Galarneau [Thu, 23 Nov 2017 02:16:38 +0000 (21:16 -0500)] 
Fix: evaluate trigger condition on registration

Since there is nothing preventing clients from subscribing to a
condition before the corresponding trigger is registered, we have
to evaluate this new condition right away.

The current implementation is waiting for the next "evaluation" of
conditions (e.g. on reception of a channel sample) to evaluate this
newly registered trigger conditions, but this is broken.

The reason it is broken is that waiting for the next sample
does not allow us to properly handle transitions for edge-triggered
conditions.

Consider this example: when we handle a new channel sample, we
evaluate each conditions twice: once with the previous state, and
again with the newest state. We then use those two results to
determine whether a state change happened: a condition was false and
became true. If a state change happened, we have to notify clients.

Now, if a client subscribes to a given notification and registers
a trigger *after* that subscription, we have to make sure the
condition is evaluated at this point while considering only the
current state. Otherwise, the next evaluation cycle may only see
that the evaluations remain the same (true for samples n-1 and n) and
the client will never know that the condition has been met.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: nonsensical message printed by lttng track/untrack
Jérémie Galarneau [Tue, 14 Nov 2017 02:16:18 +0000 (21:16 -0500)] 
Fix: nonsensical message printed by lttng track/untrack

The lttng track/untrack command, when used to track/untrack all
PIDs, prints a message of the following form:

"PID -1 untracked in session auto-20171113-210309"

This is because -1 is taken to mean "all" by the API and is used
as-is to print the message on the CLI.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: O_CLOEXEC is erroneously used on pipe creation
Julien Desfossez [Mon, 13 Nov 2017 23:15:54 +0000 (18:15 -0500)] 
Fix: O_CLOEXEC is erroneously used on pipe creation

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: wrong parameter to fcntl in pipe_set_flag
Julien Desfossez [Mon, 13 Nov 2017 23:14:49 +0000 (18:14 -0500)] 
Fix: wrong parameter to fcntl in pipe_set_flag

Depending on the flags passed, fcntl must be called with F_SETFD or
F_SETFL. This fix checks the flag passed and ensure it is valid and
calls fcntl with the right parameter.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: use lttng_clock_gettime instead of clock_gettime
Jonathan Rajotte [Wed, 18 Oct 2017 15:39:06 +0000 (11:39 -0400)] 
Fix: use lttng_clock_gettime instead of clock_gettime

It appears that commit 389fbf04b41e2002be44a1e3392bfade2f1deeef missed
it.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: close channel monitor pipe after killing the metadata_timer_thread
Jonathan Rajotte [Thu, 12 Oct 2017 15:19:39 +0000 (11:19 -0400)] 
Fix: close channel monitor pipe after killing the metadata_timer_thread

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: path of snapshots with a relay and default URI
Julien Desfossez [Wed, 30 Aug 2017 18:06:42 +0000 (14:06 -0400)] 
Fix: path of snapshots with a relay and default URI

When recording a snapshot to a relay without custom URI (ex:
net://localhost vs net://localhost/custom), the snapshots end up being
stored in ~/lttng-traces/<hostname>/snapshot-XXX instead of being inside
the <session-name> folder like on local snapshots. We would expect the
path to be: ~/lttng-traces/<hostname>/<session-name>/snapshot-XXX

So there is a discrepancy between the local and remote behaviour. This
behaviour has been there since at least v2.6, maybe earlier.

Moreover, there is nothing that informs the user about the default
snapshot name, so it is not possible to know where a snapshot has been
stored.

After parsing the URI provided by the user, we now check if a custom
name was provided or copy the session name there. This is the same
operation performed in _lttng_create_session_ext.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: use file based synchronization for python logging test
Jonathan Rajotte [Mon, 28 Aug 2017 21:50:04 +0000 (17:50 -0400)] 
Fix: use file based synchronization for python logging test

No synchronization yield unstable result on a stressed system.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTest: add file based synchronization point for python test app
Jonathan Rajotte [Mon, 28 Aug 2017 21:50:03 +0000 (17:50 -0400)] 
Test: add file based synchronization point for python test app

test.py is responsible for the cleanup of the "ready" file while the
cleanup of the "go" file is left to the external controller.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: wrong use of the relay_streams_sent in snapshot
Julien Desfossez [Wed, 23 Aug 2017 20:48:53 +0000 (16:48 -0400)] 
Fix: wrong use of the relay_streams_sent in snapshot

The relay_streams_sent message is only useful in live sessions and
should only be sent after all the streams of a channel have been sent.

Here we were sending this message every time we sent a stream to the
relay during a snapshot which makes no sense.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: the return code of lttcomm_send_unix_sock is signed
Julien Desfossez [Wed, 23 Aug 2017 20:43:22 +0000 (16:43 -0400)] 
Fix: the return code of lttcomm_send_unix_sock is signed

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix warning: src/bin/lttng/utils.c: cast incompatible pointer
Jérémie Galarneau [Mon, 13 Nov 2017 15:31:29 +0000 (10:31 -0500)] 
Fix warning: src/bin/lttng/utils.c: cast incompatible pointer

Reported-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: src/common/pipe.h: include <sys/types.h> for ssize_t and mode_t
Philippe Proulx [Wed, 8 Nov 2017 20:19:24 +0000 (15:19 -0500)] 
Fix: src/common/pipe.h: include <sys/types.h> for ssize_t and mode_t

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: detect dlmopen() and disable corresponding tests if not available
Philippe Proulx [Mon, 6 Nov 2017 23:46:41 +0000 (18:46 -0500)] 
Fix: detect dlmopen() and disable corresponding tests if not available

musl and uClibc-ng are known not to support dlmopen(). LTTng-UST has
this dlmopen() detection.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: Use tmpdir for intermediary files
Jonathan Rajotte [Sun, 12 Nov 2017 21:15:53 +0000 (16:15 -0500)] 
Fix: Use tmpdir for intermediary files

Launching root and non-root testing would result in conflict.

Remove unused TRACE_PATH assignation.
Clear the pipe list variable before each pipe collecting.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: include scripts for distribution
Jonathan Rajotte [Sun, 12 Nov 2017 20:36:52 +0000 (15:36 -0500)] 
Fix: include scripts for distribution

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: typo in lttng-consumerd file default
Jérémie Galarneau [Sun, 12 Nov 2017 20:19:56 +0000 (15:19 -0500)] 
Fix: typo in lttng-consumerd file default

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: missing NULL checks in logging statements
Jérémie Galarneau [Sun, 12 Nov 2017 20:19:35 +0000 (15:19 -0500)] 
Fix: missing NULL checks in logging statements

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: kernel consumerd sock paths need rundir substitution
Jérémie Galarneau [Sun, 12 Nov 2017 19:59:28 +0000 (14:59 -0500)] 
Fix: kernel consumerd sock paths need rundir substitution

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTest: kernel testing for notification
Jonathan Rajotte [Fri, 28 Jul 2017 17:40:41 +0000 (13:40 -0400)] 
Test: kernel testing for notification

Perform notification tests on both domains.

Scenarios where low notifications are wanted need further synchronization
since multiple low notifications can be sent between resume_consumer
and the lttng stop command. This problem can be addressed by suspending
the generation of events. This is achieved by the use of signal-aware
background shells and the use of lttng-test kernel module or
gen-ust-events as events generator.

These background shells are controlled by signal SIGUSR1 and
provide their states via a state file. If the file is present the
application is suspended and does not generate events, otherwise events
are generated.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: create lttng run dir regardless of user privilege
Jérémie Galarneau [Sun, 12 Nov 2017 19:19:01 +0000 (14:19 -0500)] 
Fix: create lttng run dir regardless of user privilege

The changes made when centralizing the configuration handling
introduced a regression which cause the rundir to only be
created when running as the root user.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: Make version.h generation work with dash
Olivier Blin [Fri, 27 Oct 2017 09:46:19 +0000 (11:46 +0200)] 
Fix: Make version.h generation work with dash

version.h generation failed when using dash as shell:
Generating version.h... /bin/sh: 24: Syntax error: Missing '))'

dash does not handle the following construct:
git_describe="$((cd /path/to/lttng-tools/.; git describe) 2>/dev/null)"

Use backquotes instead.

The fix has been tested with dash and bash.

Signed-off-by: Olivier Blin <olivier.blin@softathome.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agolttng-enable-event(1): filtering: specify that `$ctx.cpu_id` is available
Philippe Proulx [Fri, 8 Sep 2017 02:52:48 +0000 (22:52 -0400)] 
lttng-enable-event(1): filtering: specify that `$ctx.cpu_id` is available

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agocentralize sessiond config option handling
Jérémie Galarneau [Thu, 9 Nov 2017 22:46:54 +0000 (17:46 -0500)] 
centralize sessiond config option handling

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: buffer overflow warning in python bindings
Jérémie Galarneau [Sun, 12 Nov 2017 16:41:47 +0000 (11:41 -0500)] 
Fix: buffer overflow warning in python bindings

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoTests fix: BT2 does not output the metadata of a trace collection
Jérémie Galarneau [Wed, 8 Nov 2017 19:02:07 +0000 (14:02 -0500)] 
Tests fix: BT2 does not output the metadata of a trace collection

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoUpdate version to 2.11.0-pre
Jérémie Galarneau [Mon, 7 Aug 2017 20:07:53 +0000 (16:07 -0400)] 
Update version to 2.11.0-pre

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoTypo: occured -> occurred
Michael Jeanson [Wed, 2 Aug 2017 18:26:18 +0000 (14:26 -0400)] 
Typo: occured -> occurred

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: ensure kernel context is in a list before trying to delete it
Jérémie Galarneau [Wed, 2 Aug 2017 20:49:44 +0000 (16:49 -0400)] 
Fix: ensure kernel context is in a list before trying to delete it

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoHarmonize return code conventions in context handling
Jérémie Galarneau [Wed, 2 Aug 2017 19:24:00 +0000 (15:24 -0400)] 
Harmonize return code conventions in context handling

7 years agoFix: uninitialized return value on error path
Mathieu Desnoyers [Wed, 2 Aug 2017 15:34:43 +0000 (11:34 -0400)] 
Fix: uninitialized return value on error path

Found by Coverity:

*** CID 1378810:  Uninitialized variables  (UNINIT)
/src/bin/lttng-sessiond/context.c: 73 in add_kctx_all_channels()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agolttng enable-channel: disallow --overwrite and --blocking-timeout
Philippe Proulx [Fri, 28 Jul 2017 20:36:48 +0000 (16:36 -0400)] 
lttng enable-channel: disallow --overwrite and --blocking-timeout

The overwrite mode has no impact on LTTng-UST when there's a set
blocking timeout.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agolttng-enable-channel(1): reword --blocking-timeout, document in description
Philippe Proulx [Fri, 28 Jul 2017 20:30:42 +0000 (16:30 -0400)] 
lttng-enable-channel(1): reword --blocking-timeout, document in description

Also change the synopsis so that you can specify --blocking-timeout,
--overwrite, or none, but not both.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agolttng enable-channel: --blocking-timeout opt.: use `inf` instead of -1
Philippe Proulx [Fri, 28 Jul 2017 19:48:32 +0000 (15:48 -0400)] 
lttng enable-channel: --blocking-timeout opt.: use `inf` instead of -1

It might be -1 for the API, but for a command-line interface used by
humans, `inf` is more meaningful than -1.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: remove unused internal structure
Julien Desfossez [Fri, 28 Jul 2017 18:15:40 +0000 (14:15 -0400)] 
Cleanup: remove unused internal structure

There is TODO to add content to lttcomm_relayd_update_sync_info
since 2012 (commit 173af62f4804133d4a7f45e34b6f72126f3eca5f),
the intent is really not clear and this is never going to
happen, let's remove it.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: remove unnecessary extern qualifier
Jérémie Galarneau [Tue, 1 Aug 2017 18:53:25 +0000 (14:53 -0400)] 
Cleanup: remove unnecessary extern qualifier

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoDocs: document the trigger API
Jérémie Galarneau [Tue, 1 Aug 2017 18:52:57 +0000 (14:52 -0400)] 
Docs: document the trigger API

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoDocs: document the notification API
Jérémie Galarneau [Tue, 1 Aug 2017 18:29:02 +0000 (14:29 -0400)] 
Docs: document the notification API

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoDocs: document the notification channel API
Jérémie Galarneau [Tue, 1 Aug 2017 18:23:43 +0000 (14:23 -0400)] 
Docs: document the notification channel API

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoDocs: document the evaluation API
Jérémie Galarneau [Tue, 1 Aug 2017 17:57:39 +0000 (13:57 -0400)] 
Docs: document the evaluation API

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoDocs: document the lttng_condition API
Jérémie Galarneau [Tue, 1 Aug 2017 16:25:57 +0000 (12:25 -0400)] 
Docs: document the lttng_condition API

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoDocs: document the lttng_buffer_usage condition API
Jérémie Galarneau [Mon, 31 Jul 2017 18:58:18 +0000 (14:58 -0400)] 
Docs: document the lttng_buffer_usage condition API

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoDocs: document the lttng_action_notify action type
Jérémie Galarneau [Mon, 31 Jul 2017 18:08:19 +0000 (14:08 -0400)] 
Docs: document the lttng_action_notify action type

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoDocs: document the lttng_action API
Jérémie Galarneau [Mon, 31 Jul 2017 18:07:59 +0000 (14:07 -0400)] 
Docs: document the lttng_action API

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: ambiguous ownership of kernel context by multiple channels
Jérémie Galarneau [Mon, 31 Jul 2017 21:51:35 +0000 (17:51 -0400)] 
Fix: ambiguous ownership of kernel context by multiple channels

A kernel context, when added to multiple channels, must be copied
before being added to individual channels. The current code
adds the same ltt_kernel_context structure to multiple kernel
channels which introduces a conceptual ambiguity in the ownership
of the context object.

Concretely, creating multiple kernel channels and adding a context
to all of them (by not specifying a channel name) causes the context
to be added to each channels' list of contexts, overwritting the
context's list node, and causing the channel context lists to become
corrupted. This results in crashes being observed during the
destruction of the session.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agolttng-enable-channel(1): move --output description to maintain A-Z ordering
Philippe Proulx [Mon, 31 Jul 2017 18:09:44 +0000 (14:09 -0400)] 
lttng-enable-channel(1): move --output description to maintain A-Z ordering

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agolttng-enable-channel(1): document --monitor-timer
Philippe Proulx [Mon, 31 Jul 2017 18:08:28 +0000 (14:08 -0400)] 
lttng-enable-channel(1): document --monitor-timer

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPrettify channel listing
Jérémie Galarneau [Fri, 28 Jul 2017 21:00:07 +0000 (17:00 -0400)] 
Prettify channel listing

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoUse pipe instead of eventfd() for notification command queue
Jonathan Rajotte [Thu, 27 Jul 2017 22:39:45 +0000 (18:39 -0400)] 
Use pipe instead of eventfd() for notification command queue

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: useless reset of ret to zero
Jonathan Rajotte [Wed, 26 Jul 2017 14:53:53 +0000 (10:53 -0400)] 
Cleanup: useless reset of ret to zero

ret is overwritten in the normal code flow.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: ret is never used on error_open code path
Jonathan Rajotte [Wed, 26 Jul 2017 14:52:15 +0000 (10:52 -0400)] 
Fix: ret is never used on error_open code path

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: use error code path instead of break when errors happen before execl
Jonathan Rajotte [Wed, 26 Jul 2017 14:29:17 +0000 (10:29 -0400)] 
Fix: use error code path instead of break when errors happen before execl

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: ignore useless check of execl() return value
Jonathan Rajotte [Tue, 25 Jul 2017 21:56:58 +0000 (17:56 -0400)] 
Cleanup: ignore useless check of execl() return value

execl only return if there is an error. errno is handled hence no need
to consider the return value which would always be -1.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: wrong variable assignment on error
Jonathan Rajotte [Tue, 25 Jul 2017 21:46:47 +0000 (17:46 -0400)] 
Fix: wrong variable assignment on error

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: remove dead increment of pointer
Jonathan Rajotte [Tue, 25 Jul 2017 21:43:58 +0000 (17:43 -0400)] 
Cleanup: remove dead increment of pointer

No further memcpy is performed no need to increment the pointer.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: missing error handling in use of print_tabs()
Jonathan Rajotte [Tue, 25 Jul 2017 21:20:45 +0000 (17:20 -0400)] 
Fix: missing error handling in use of print_tabs()

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: functions shall have a single exit point
Jonathan Rajotte [Tue, 25 Jul 2017 21:12:31 +0000 (17:12 -0400)] 
Cleanup: functions shall have a single exit point

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: remove dead assignment
Jonathan Rajotte [Tue, 25 Jul 2017 20:57:50 +0000 (16:57 -0400)] 
Cleanup: remove dead assignment

Only handle cases where the returned error is not EEXIST. ret is
overwritten anyway.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: remove dead assignment
Jonathan Rajotte [Tue, 25 Jul 2017 20:29:53 +0000 (16:29 -0400)] 
Cleanup: remove dead assignment

ret is not used when jumping to error_no_alloc.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: remove dead assignment
Jonathan Rajotte [Tue, 25 Jul 2017 20:26:25 +0000 (16:26 -0400)] 
Cleanup: remove dead assignment

Both calling sites do not use the return value and errors are already
managed inside the called function.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: remove dead assignment
Jonathan Rajotte [Tue, 25 Jul 2017 19:55:31 +0000 (15:55 -0400)] 
Cleanup: remove dead assignment

Artifact of refactor done in f8f3885cc52af9d3c951da78989d6f4a25270411

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: remove dead assignment
Jonathan Rajotte [Tue, 25 Jul 2017 19:51:34 +0000 (15:51 -0400)] 
Cleanup: remove dead assignment

ret is not used for further error propagation.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: remove dead assignment
Jonathan Rajotte [Tue, 25 Jul 2017 18:11:02 +0000 (14:11 -0400)] 
Cleanup: remove dead assignment

ret is overwritten no need to reset it.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: remove dead assignment
Jonathan Rajotte [Tue, 25 Jul 2017 18:07:30 +0000 (14:07 -0400)] 
Cleanup: remove dead assignment

ret is always overwritten hence assign a value here is not necessary.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: remove dead assignment
Jonathan Rajotte [Tue, 25 Jul 2017 18:05:17 +0000 (14:05 -0400)] 
Cleanup: remove dead assignment

ret is never used in error code path.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: remove dead assignment
Jonathan Rajotte [Tue, 25 Jul 2017 18:03:36 +0000 (14:03 -0400)] 
Cleanup: remove dead assignment

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: dead assignment
Jonathan Rajotte [Tue, 25 Jul 2017 18:01:48 +0000 (14:01 -0400)] 
Cleanup: dead assignment

ret is never used for error, use err instead.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: ret is used instead or err to set an error code
Jonathan Rajotte [Tue, 25 Jul 2017 15:31:02 +0000 (11:31 -0400)] 
Fix: ret is used instead or err to set an error code

Use err instead of ret. ret is never used for error reporting under
error label.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: remove dead assignment
Jonathan Rajotte [Tue, 25 Jul 2017 15:14:55 +0000 (11:14 -0400)] 
Cleanup: remove dead assignment

Artifact of refactoring done in f8f3885cc52af9d3c951da78989d6f4a25270411

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: remove dead assignment
Jonathan Rajotte [Tue, 25 Jul 2017 14:54:48 +0000 (10:54 -0400)] 
Cleanup: remove dead assignment

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: report error using fd instead of ret
Jonathan Rajotte [Tue, 25 Jul 2017 14:45:32 +0000 (10:45 -0400)] 
Fix: report error using fd instead of ret

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agolttng-enable-channel(1): reword and fix style of --blocking-timeout description
Philippe Proulx [Tue, 25 Jul 2017 01:42:49 +0000 (21:42 -0400)] 
lttng-enable-channel(1): reword and fix style of --blocking-timeout description

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: doc/man: use a single XSL file and match local names
Philippe Proulx [Tue, 25 Jul 2017 01:36:36 +0000 (21:36 -0400)] 
Fix: doc/man: use a single XSL file and match local names

Matching the local name instead of the full name, that is:

   *[local-name() = 'co']

instead of just `co` matches both the non-namespaced element and
the DocBook-namespaced element whether we're using the DocBook 4.5 or
DocBook 5.0 stylesheets.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoTests: rework select_poll_epoll test to improve verbosity on failure
Francis Deslauriers [Mon, 12 Jun 2017 16:13:23 +0000 (12:13 -0400)] 
Tests: rework select_poll_epoll test to improve verbosity on failure

Prints the tested values that caused a test failure to ease the
troubleshooting of unreliable tests.
Also, clean-up unused variables in multiple testcases.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoOnly print relevant session statistics on stop
Jérémie Galarneau [Fri, 28 Jul 2017 15:26:09 +0000 (11:26 -0400)] 
Only print relevant session statistics on stop

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: NULL passed to memcpy in error path
Jérémie Galarneau [Fri, 28 Jul 2017 14:59:30 +0000 (10:59 -0400)] 
Fix: NULL passed to memcpy in error path

CID 1378708:  Null pointer dereferences  (FORWARD_NULL)
Passing null pointer "data" to "memcpy", which dereferences it.

Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoOnly print relevant session statistics in channel listing
Jérémie Galarneau [Fri, 28 Jul 2017 14:42:46 +0000 (10:42 -0400)] 
Only print relevant session statistics in channel listing

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoUniformize the printing of units in session listing
Jérémie Galarneau [Thu, 27 Jul 2017 21:55:14 +0000 (17:55 -0400)] 
Uniformize the printing of units in session listing

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: lost packet accounting always lost on snapshot
Julien Desfossez [Tue, 25 Jul 2017 19:23:49 +0000 (15:23 -0400)] 
Fix: lost packet accounting always lost on snapshot

Because of the continue when we fail to get a subbuff, the lost_packet
count is always reset to 0 before we can account it in the channel. Now
we account it directly before the continue.

Reported-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: report error on session listing
Jonathan Rajotte [Fri, 21 Jul 2017 15:09:14 +0000 (11:09 -0400)] 
Fix: report error on session listing

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoTests: don't assume a 4K page size in test_notification
Jérémie Galarneau [Thu, 27 Jul 2017 20:48:44 +0000 (16:48 -0400)] 
Tests: don't assume a 4K page size in test_notification

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix live-comm: merge TCP socket write-write sequence in a single write
Jonathan Rajotte [Mon, 24 Jul 2017 20:07:00 +0000 (16:07 -0400)] 
Fix live-comm: merge TCP socket write-write sequence in a single write

The live protocol implementation is often sending content
on TCP sockets in two separate writes. One to send a command header,
and the second one sending the command's payload. This was presumably
done under the assumption that it would not result in two separate
TCP packets being sent on the network (or that it would not matter).

Delayed ACK-induced delays were observed [1] on the second write of the
"write header, write payload" sequence and result in problematic
latency build-ups for live clients connected to moderately/highly
active sessions.

Fundamentaly, this problem arises due to the combination of Nagle's
algorithm and the delayed ACK mechanism which make write-write-read
sequences on TCP sockets problematic as near-constant latency is
expected when clients can keep-up with the event production rate.

In such a write-write-read sequence, the second write is held up until
the first write is acknowledged (TCP ACK). The solution implemented
by this patch bundles the writes into a single one [2].

[1] https://github.com/tbricks/wireshark-lttng-plugin
    Basic Wireshark dissector for lttng-live by Anto Smyk from Itiviti
[2] https://lists.freebsd.org/pipermail/freebsd-net/2006-January/009527.html

Reported-by: Anton Smyk <anton.smyk@itiviti.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoDocs: move notification thread documentation to header
Jérémie Galarneau [Wed, 26 Jul 2017 18:46:35 +0000 (14:46 -0400)] 
Docs: move notification thread documentation to header

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoDocs: grammar fix in comment
Jérémie Galarneau [Wed, 26 Jul 2017 18:46:09 +0000 (14:46 -0400)] 
Docs: grammar fix in comment

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: evaluate condition/trigger on subscription
Jonathan Rajotte [Tue, 4 Jul 2017 18:58:43 +0000 (14:58 -0400)] 
Fix: evaluate condition/trigger on subscription

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoTest: Trigger conditions is evaluated on subscription
Jonathan Rajotte [Tue, 4 Jul 2017 18:58:42 +0000 (14:58 -0400)] 
Test: Trigger conditions is evaluated on subscription

It is expected that on subscription a trigger condition is evaluated and
the trigger fired if necessary. Currently evaluation is performed on
channel sampling and result in action only if the evaluation state flip.

This test hang if no evaluation is performed on notification client
subscription.

Ref #1102

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agosave/load: add blocking_timeout attribute to channel
Jonathan Rajotte [Thu, 6 Jul 2017 15:08:43 +0000 (11:08 -0400)] 
save/load: add blocking_timeout attribute to channel

Fixes #1119

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoIntroduce monitor_timer_interval to session configuration schema
Jonathan Rajotte [Thu, 6 Jul 2017 15:08:42 +0000 (11:08 -0400)] 
Introduce monitor_timer_interval to session configuration schema

Session configuration schema version is bumped to 2.10

Fixes #1099

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.044499 seconds and 4 git commands to generate.