lttng-tools.git
5 years agofd-tracker: remove unneeded header inclusion
Jérémie Galarneau [Fri, 6 Jul 2018 02:45:11 +0000 (22:45 -0400)] 
fd-tracker: remove unneeded header inclusion

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agofd-tracker: add an optimization note to the fd-tracker
Jérémie Galarneau [Fri, 6 Jul 2018 02:43:33 +0000 (22:43 -0400)] 
fd-tracker: add an optimization note to the fd-tracker

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: lttng-track(1), lttng-untrack(1): document new properties/options
Philippe Proulx [Thu, 5 Jul 2018 16:01:07 +0000 (12:01 -0400)] 
Backport: lttng-track(1), lttng-untrack(1): document new properties/options

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
5 years agoBackport: trackers: bump MI version to 4.0
Mathieu Desnoyers [Thu, 5 Jul 2018 15:08:40 +0000 (11:08 -0400)] 
Backport: trackers: bump MI version to 4.0

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoBackport: trackers: commands: validate duplicate options
Mathieu Desnoyers [Thu, 5 Jul 2018 14:50:18 +0000 (10:50 -0400)] 
Backport: trackers: commands: validate duplicate options

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoBackport: Fix: tracker: no command shortcut for new trackers
Mathieu Desnoyers [Thu, 5 Jul 2018 14:40:08 +0000 (10:40 -0400)] 
Backport: Fix: tracker: no command shortcut for new trackers

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoBackport: trackers: add sessiond tracker list implementation
Mathieu Desnoyers [Thu, 5 Jul 2018 14:31:01 +0000 (10:31 -0400)] 
Backport: trackers: add sessiond tracker list implementation

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoBackport: Fix: tracker: list/track/untrack commands leak strings
Mathieu Desnoyers [Wed, 4 Jul 2018 22:12:14 +0000 (18:12 -0400)] 
Backport: Fix: tracker: list/track/untrack commands leak strings

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoBackport: Fix: tracker: ensure consistency of tracker states
Mathieu Desnoyers [Wed, 4 Jul 2018 21:51:47 +0000 (17:51 -0400)] 
Backport: Fix: tracker: ensure consistency of tracker states

On error when adding/removing from either UST or kernel trackers,
we need to roll back the state of our internal lists.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoBackport: trackers: tests: adapt tests to new xsd schemas
Mathieu Desnoyers [Wed, 4 Jul 2018 20:12:54 +0000 (16:12 -0400)] 
Backport: trackers: tests: adapt tests to new xsd schemas

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoBackport: trackers: update MI to new xsd schema
Mathieu Desnoyers [Wed, 4 Jul 2018 20:13:43 +0000 (16:13 -0400)] 
Backport: trackers: update MI to new xsd schema

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoBackport: trackers: update config xsd schema
Mathieu Desnoyers [Wed, 4 Jul 2018 20:14:20 +0000 (16:14 -0400)] 
Backport: trackers: update config xsd schema

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoBackport: trackers: update lttng-sessiond
Mathieu Desnoyers [Wed, 4 Jul 2018 20:46:25 +0000 (16:46 -0400)] 
Backport: trackers: update lttng-sessiond

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoBackport: trackers: update list/track/untrack commands
Mathieu Desnoyers [Wed, 4 Jul 2018 20:17:48 +0000 (16:17 -0400)] 
Backport: trackers: update list/track/untrack commands

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoBackport: trackers: update liblttng-ctl
Mathieu Desnoyers [Wed, 4 Jul 2018 20:17:26 +0000 (16:17 -0400)] 
Backport: trackers: update liblttng-ctl

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoBackport: trackers: update sessiond communication protocol
Mathieu Desnoyers [Wed, 4 Jul 2018 20:16:47 +0000 (16:16 -0400)] 
Backport: trackers: update sessiond communication protocol

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoBackport: trackers: update lttng-modules tracer ABI
Mathieu Desnoyers [Wed, 4 Jul 2018 20:15:07 +0000 (16:15 -0400)] 
Backport: trackers: update lttng-modules tracer ABI

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoBackport: trackers: change error code from "pid" to "id"
Mathieu Desnoyers [Wed, 4 Jul 2018 20:11:17 +0000 (16:11 -0400)] 
Backport: trackers: change error code from "pid" to "id"

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoBackport: LTTNG-RELAYD(8): document the --fd-pool-size option
Jérémie Galarneau [Thu, 5 Jul 2018 01:28:18 +0000 (21:28 -0400)] 
Backport: LTTNG-RELAYD(8): document the --fd-pool-size option

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: rename fd-cap parameter to fd-pool-size
Jérémie Galarneau [Tue, 3 Jul 2018 17:49:43 +0000 (13:49 -0400)] 
Backport: relayd: rename fd-cap parameter to fd-pool-size

Rename the fd-cap parameter and change its default behaviour.
The minimum number of file descriptor is raised to 100 and a
"reserve" amount of 10 fds is allowed to accomodate transient
fd uses that can't be tracked by the relay daemon.

The --fd-pool-size will accept parameters in the
[100, fileno soft limit] interval.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: fd-tracker: log tracker capacity on creation
Jérémie Galarneau [Tue, 3 Jul 2018 17:48:29 +0000 (13:48 -0400)] 
Backport: fd-tracker: log tracker capacity on creation

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: replace lttng_index_file with relay_index_file
Jérémie Galarneau [Sun, 1 Jul 2018 03:20:43 +0000 (23:20 -0400)] 
Backport: relayd: replace lttng_index_file with relay_index_file

lttng_index_file is shared between the consumer and relay daemon.
However, the introduction of the fd-tracker in the relay daemon
makes it hard to cleanly share this piece of code between both
daemons.

The ctf-index.h header is still shared by both daemons which
is the most important part. The lttng/relay_index_file class
is a fairly thin wrapper around file system operations (unlink,
read, and write an index) so there is little value gained in
sharing the code vs heavily modifying it to handle the presence
of an fd-tracker in the process.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: Move index initialization to ctf-index.h
Jérémie Galarneau [Sat, 30 Jun 2018 18:51:55 +0000 (14:51 -0400)] 
Backport: Move index initialization to ctf-index.h

This initialization code is moved to a common header to re-use
it in a follow-up patch.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: Fix: fully initialize viewer stream before publishing it
Jérémie Galarneau [Fri, 29 Jun 2018 22:05:47 +0000 (18:05 -0400)] 
Backport: Fix: fully initialize viewer stream before publishing it

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: use the fd-tracker to track stream_fd fds
Jérémie Galarneau [Fri, 29 Jun 2018 21:48:58 +0000 (17:48 -0400)] 
Backport: relayd: use the fd-tracker to track stream_fd fds

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: track the live client connections socket
Jérémie Galarneau [Thu, 28 Jun 2018 05:22:06 +0000 (01:22 -0400)] 
Backport: relayd: track the live client connections socket

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: track relayd control connection sockets
Jérémie Galarneau [Thu, 28 Jun 2018 05:16:56 +0000 (01:16 -0400)] 
Backport: relayd: track relayd control connection sockets

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: track relayd data connection sockets
Jérémie Galarneau [Thu, 28 Jun 2018 05:16:43 +0000 (01:16 -0400)] 
Backport: relayd: track relayd data connection sockets

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: track the data listener socket
Jérémie Galarneau [Thu, 28 Jun 2018 04:15:54 +0000 (00:15 -0400)] 
Backport: relayd: track the data listener socket

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: track the control listener socket
Jérémie Galarneau [Thu, 28 Jun 2018 04:15:40 +0000 (00:15 -0400)] 
Backport: relayd: track the control listener socket

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: track the live listener socket
Jérémie Galarneau [Thu, 28 Jun 2018 04:14:52 +0000 (00:14 -0400)] 
Backport: relayd: track the live listener socket

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: track stdio output fds
Jérémie Galarneau [Thu, 28 Jun 2018 03:16:44 +0000 (23:16 -0400)] 
Backport: relayd: track stdio output fds

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: track the live viewer worker thread's epoll fd
Jérémie Galarneau [Thu, 28 Jun 2018 02:38:52 +0000 (22:38 -0400)] 
Backport: relayd: track the live viewer worker thread's epoll fd

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: track the live listener thread's epoll fd
Jérémie Galarneau [Thu, 28 Jun 2018 02:36:05 +0000 (22:36 -0400)] 
Backport: relayd: track the live listener thread's epoll fd

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: track the live_conn_pipe with the fd-tracker
Jérémie Galarneau [Thu, 28 Jun 2018 02:30:37 +0000 (22:30 -0400)] 
Backport: relayd: track the live_conn_pipe with the fd-tracker

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: track listener's epoll fd using the fd-tracker
Jérémie Galarneau [Wed, 27 Jun 2018 19:48:53 +0000 (15:48 -0400)] 
Backport: relayd: track listener's epoll fd using the fd-tracker

This addresses the bogus fd report mentionned in a previous
patch of this series as the clean-up of the listener thread's
epoll fd now occurs through the fd-tracker.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: track worker thread's epoll fd using the fd-tracker
Jérémie Galarneau [Wed, 27 Jun 2018 19:42:38 +0000 (15:42 -0400)] 
Backport: relayd: track worker thread's epoll fd using the fd-tracker

This commit introduces an fd leak report (bogus) which is caused
by another thread using the same poll initialization functions as
the worker thread.

The fd is cleaned-up by that other thread, but the fd-tracker
is not aware of this, thus causing the report.

This is adressed in a follow-up patch.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: track the health thread's poll fd with fd-tracker
Jérémie Galarneau [Wed, 27 Jun 2018 18:58:48 +0000 (14:58 -0400)] 
Backport: relayd: track the health thread's poll fd with fd-tracker

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: track clients of the health unix socket with the fd-tracker
Jérémie Galarneau [Tue, 26 Jun 2018 21:38:22 +0000 (17:38 -0400)] 
Backport: relayd: track clients of the health unix socket with the fd-tracker

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: track the health unix socket with the fd-tracker
Jérémie Galarneau [Tue, 26 Jun 2018 21:20:47 +0000 (17:20 -0400)] 
Backport: relayd: track the health unix socket with the fd-tracker

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: track the health quit pipe with the fd-tracker
Jérémie Galarneau [Tue, 26 Jun 2018 19:17:16 +0000 (15:17 -0400)] 
Backport: relayd: track the health quit pipe with the fd-tracker

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: track the relay_conn_pipe with the fd-tracker
Jérémie Galarneau [Tue, 26 Jun 2018 19:07:08 +0000 (15:07 -0400)] 
Backport: relayd: track the relay_conn_pipe with the fd-tracker

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: track the quit pipe with the fd-tracker
Jérémie Galarneau [Tue, 26 Jun 2018 18:51:22 +0000 (14:51 -0400)] 
Backport: relayd: track the quit pipe with the fd-tracker

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: Don't bypass the fd tracker when closing file descriptors
Jérémie Galarneau [Tue, 19 Jun 2018 16:22:31 +0000 (12:22 -0400)] 
Backport: relayd: Don't bypass the fd tracker when closing file descriptors

There is no reason to close all file descriptors at this point in
the relay daemon as we know for a fact that the only open fds
are stdin, stdout, and stderr. If the relayd was to depend on a
library that opens other file descriptors, it would be unadvisable
to perform this kind of bulk closing of all possible file descriptors.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: close stdin
Jérémie Galarneau [Tue, 19 Jun 2018 02:45:27 +0000 (22:45 -0400)] 
Backport: relayd: close stdin

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: relayd: initialize the global fd tracker from fd_cap parameter
Jérémie Galarneau [Wed, 27 Jun 2018 19:04:49 +0000 (15:04 -0400)] 
Backport: relayd: initialize the global fd tracker from fd_cap parameter

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: Add fd-cap option to the relay daemon
Jérémie Galarneau [Mon, 18 Jun 2018 22:39:07 +0000 (18:39 -0400)] 
Backport: Add fd-cap option to the relay daemon

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: Test: add a unit test for the fd tracker
Jérémie Galarneau [Tue, 19 Jun 2018 18:27:01 +0000 (14:27 -0400)] 
Backport: Test: add a unit test for the fd tracker

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: fd-tracker: add pipe management wrappers to fd-tracker
Jérémie Galarneau [Wed, 27 Jun 2018 20:38:17 +0000 (16:38 -0400)] 
Backport: fd-tracker: add pipe management wrappers to fd-tracker

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: fd-tracker: add epoll/poll management wrappers to fd-tracker
Jérémie Galarneau [Wed, 27 Jun 2018 19:05:06 +0000 (15:05 -0400)] 
Backport: fd-tracker: add epoll/poll management wrappers to fd-tracker

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: fd-tracker: add an fd-tracker util to common
Jérémie Galarneau [Thu, 14 Jun 2018 02:55:29 +0000 (22:55 -0400)] 
Backport: fd-tracker: add an fd-tracker util to common

This commit adds an fd-tracker utility to the common libs.
This interface allows a process to keep track of its open
file descriptors and enforce a limit to the number of file
descriptors that may be simultaneously opened.

The intent is to use this interface as part of the relay daemon
to mitigate file descriptors exhaustion problems that are
encountered when the relay has to handle a large number of streams.

The fd-tracker defines two classes of file descriptors: suspendable
and unsuspendable file descriptors.

Suspendable file descriptors are handles to filesystem objects
(e.g. regular files) that may be closed and re-opened later without
affecting the application.

A suspendable file descriptor can be opened by creating a filesystem
handle (fs_handle) using the fd-tracker. The raw file descritptor
must then be obtained and released using that handle. Closing the
handle will effectively ensure that the file descritptor is closed.

Unsuspendable file descriptors are file descriptors that cannot
be closed without affecting the application's state. For instance,
it is not possible to close and re-open a pipe, a TCP socket, or
an epoll fd without involving some app-specific logic. Thus, the
fd-tracker considers those file descriptors as unsuspendable.

Opening an unsuspendable file descritptor will return a raw file
decriptor to the application. It is its responsability to notify the
fd-tracker of the file descriptor's closing to ensure the number
of active file descriptors can be tracked accurately.

If a request to open a new file descriptors is made to the fd-tracker
and the process has already reached its maximal count of
simultaneously opened file descriptors, an attempt will be made to
suspend a suspendable file descriptor to release a slot.

Suspending a file descriptor involves:
  - verifying that the file is still available on the FS (restorable),
  - sampling its current position,
  - closing the file descriptor.

Note that suspending a file descriptor eliminates the POSIX guarantee
that a file may be unlinked at any time without affecting the
application (provided that it holds an open FD to that
file). Applications using the fd-tracker that need to maintain this
guarantee should open those files as unsuspendable file descriptors.

To protect against unlinking and file replacement scenarios, the
fd-tracker samples the files' inode number when a fs_handle is
created. This inode number will then be checked anytime the handle
is suspended or restored to ensure that the application is made
aware of the file's unavailability. This is preferable to
inadvertently opening another file of the same name if the original
file was unlinked and/or replaced between a fs_handle's suspension
and restoration.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: add DBG_NO_LOC logging macro
Jérémie Galarneau [Tue, 3 Jul 2018 01:13:23 +0000 (21:13 -0400)] 
Backport: add DBG_NO_LOC logging macro

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoDIST OOT: use build_dir version.i file
Jonathan Rajotte [Tue, 15 May 2018 21:27:52 +0000 (17:27 -0400)] 
DIST OOT: use build_dir version.i file

Requires the change of priority for include file in AM_CPPFLAGS and
that the version.h file include a "system header" version.i instead of a
local version.

Enable the passing of value from version.i to a OOT build done from a distribution
tarball. Enable a packager to touch files in custom_modifications and
generate a valid version.i file to be used in a OOT build from tarball.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
5 years agoBackport:Fix: Don't override user variables within the build system
Michael Jeanson [Tue, 2 May 2017 17:18:33 +0000 (13:18 -0400)] 
Backport:Fix: Don't override user variables within the build system

Backport: This is necessery for the following commit regarding extra
          version information. Mostly move the AM_CPPFLAGS to the
  configure.ac file.

Instead use the appropriately prefixed AM_* variables as to not interfere
when a user variable is passed to a make command. The proper use of flag
variables is documented at :

https://www.gnu.org/software/automake/manual/automake.html#Flag-Variables-Ordering

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: Introduce EXTRA_VERSION_PATCHES
Jonathan Rajotte [Mon, 14 May 2018 20:03:12 +0000 (16:03 -0400)] 
Backport: Introduce EXTRA_VERSION_PATCHES

Backport: add printing into log sessiond config

This allow third-party (packagers) to provide more information about
what custom patches were applied to the tree.

To do so, one can create emtpy files in "version/extra_patches/",
the filenames will be used to generate the EXTRA_VERSION_PATCHES
define.

Add this information to the debug log of lttng-relayd and lttng-sessiond.

Also append it at the end of the "version" command of the lttng binary.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
5 years agoBackport: Use EXTRA_VERSION_NAME and EXTRA_VERSION_DESCRIPTION
Jonathan Rajotte [Fri, 4 May 2018 18:52:02 +0000 (14:52 -0400)] 
Backport: Use EXTRA_VERSION_NAME and EXTRA_VERSION_DESCRIPTION

Backport:
    For sessiond add the sessiond_config_log function for verbose
    Printing of the version since config-sessiond does not exist in 2.9.
===

Add detailed version information to the debug log of lttng-relayd and
lttng-sessiond.

Append the extra version information at the end of the "version" command
of the lttng binary.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
5 years agoBackport: Introduce EXTRA_VERSION_NAME and EXTRA_VERSION_DESCRIPTION
Jonathan Rajotte [Fri, 4 May 2018 14:53:57 +0000 (10:53 -0400)] 
Backport: Introduce EXTRA_VERSION_NAME and EXTRA_VERSION_DESCRIPTION

Backport: remove .gitignore to accommodate dist tar patching

On version.i generation, check the content of the following files :

  * "extra_version_name"

    The first line is used to populate the EXTRA_VERSION_NAME pre-processor
    define statement.

  * "extra_version_description"

    The content is used to populate the EXTRA_VERSION_DESCRIPTION pre-processor
    define statement.

    It should contain the description of local modifications done to the tree.
    This can be used by distribution packager to specify what changes were
    applied locally. Mostly in the form of patch/commit name. All non-alpha
    numeric characters are converted to "-".

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
5 years agoBackport: Man: --group-output-by-session
Jonathan Rajotte [Wed, 27 Jun 2018 00:48:24 +0000 (20:48 -0400)] 
Backport: Man: --group-output-by-session

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@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 agoBackport: Tests: lttng-relayd --group-output-per-session
Jonathan Rajotte [Sun, 24 Jun 2018 14:23:29 +0000 (10:23 -0400)] 
Backport: Tests: lttng-relayd --group-output-per-session

Backport: Remove rotation related tests

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoBackport: Use lttng_snapshot_add_output_ok from utils
Jonathan Rajotte [Fri, 22 Jun 2018 17:53:22 +0000 (13:53 -0400)] 
Backport: Use lttng_snapshot_add_output_ok from utils

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoBackport: lttng_snapshot_add_output_ok: let the caller specify the output type
Jonathan Rajotte [Fri, 22 Jun 2018 17:51:58 +0000 (13:51 -0400)] 
Backport: lttng_snapshot_add_output_ok: let the caller specify the output type

Also add support for additional options.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoBackport: Relayd: introduce --group-output-by-session
Jonathan Rajotte [Tue, 19 Jun 2018 02:46:25 +0000 (22:46 -0400)] 
Backport: Relayd: introduce --group-output-by-session

LTTng-relayd now support the grouping of trace data per session name.
This mode can be used via the "--group-output-per-session"

The default, and current way, of grouping is done around the hostname of
the traced system.

When grouped by host the following folder hierarchy is mostly found on the filesystem:

    <hostname>/<session_name>[-<datetime>]/<trace>

When using "--group-output-per-session", the following hierarchy is
found on the filesystem:

    <session_name>/<hostname>[-<datetime>]/<trace>

The datetime is not always present given how it is generated in certain
situations either on the client (cli) or in lttng-sessiond and specified
output type.

This commit ensure maximum compatibility with all lttng-relayd client
(lttng-consumerd) version.

Further work can be accomplished on the
client (cli), lttng-sessiond, lttng-consumerd to pass individual path
information: session name, datetime and hostname. Note that the
automatic naming can be problematic since the datetime is used inside
the session name while when using a defined session name it is not part
of the session name. Still, this would leave older lttng-relayd client
version in the dark given that such modification would require
communication API changes. The current solution ensure that even when
dealing with older client the grouping option is respected.

The received paths are tokenized in 3 tokens.

The first one is the hostname. This is respected across all
communications. Note that, the hostname is already known since the
create session command (version >= 2.4).

The second one can either be a session name, with or without a datetime,
or extra path information. The extra path information come from the URIs
set at the client level:

    lttng create --set-url=net://localhost/extra/path/information

When the second token is extra path information the session name is
never present in the path. We reuse the name passed on the create
session command (version >= 2.4).

The datetime, if present, is extracted from the session name passed by
the client or if not present from the session name passed by the create
session command. This enable the support of automatic session name.

The third one is the rest of the path. No information extraction is done
on this token.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoBackport: Doc: lttng-relayd: --working-directory option
Jonathan Rajotte [Tue, 22 May 2018 18:25:32 +0000 (14:25 -0400)] 
Backport: Doc: lttng-relayd: --working-directory option

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoBackport: Introduce LTTNG_RELAYD_WORKING_DIRECTORY environment variable
Jonathan Rajotte [Tue, 22 May 2018 17:48:07 +0000 (13:48 -0400)] 
Backport: Introduce LTTNG_RELAYD_WORKING_DIRECTORY environment variable

LTTNG_RELAYD_WORKING_DIRECTORY is equivalent to the --working-directory
command line options.

Note: when using --working-directory, the command line option always
overwrite the environment configuration, LTTNG_RELAYD_WORKING_DIRECTORY
in this case.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoBackport: Test: lttng-relayd working directory
Jonathan Rajotte [Fri, 18 May 2018 20:24:04 +0000 (16:24 -0400)] 
Backport: Test: lttng-relayd working directory

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoBackport: Add --working-directory options to lttng-relayd
Jonathan Rajotte [Wed, 16 May 2018 22:24:01 +0000 (18:24 -0400)] 
Backport: Add --working-directory options to lttng-relayd

Base version

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoBackport: Cleanup relayd socket pair on control socket transmission error
Jonathan Rajotte [Wed, 6 Jun 2018 01:00:28 +0000 (21:00 -0400)] 
Backport: Cleanup relayd socket pair on control socket transmission error

A reference to the local ctx for the socket pair is used to "force" an
evaluation of the data and metadata stream since we changed the endpoint
status. This mostly result in the closing of all the streams for which
the relayd socket pair is linked to.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoBackport: Fix: relayd streams can be leaked on connection error
Jérémie Galarneau [Wed, 21 Feb 2018 05:57:26 +0000 (00:57 -0500)] 
Backport: Fix: relayd streams can be leaked on connection error

There are cases where a connection error can cause streams to be
leaked.

For instance, the control connection could receive an index and
close. Since a packet is in-flight, the stream corresponding to
that index will not close. However, nothing guarantees that
the data connection will be able to receive the packet's data.

If the protocol is respected, this is not a problem. However,
a buggy consumerd or network errors can cause the streams to
remain in the "data in-flight" state and never close.

To mitigate a case observed in the field where a consumerd
would be forcibly closed (network interface brought down) and
cause leaks on the relay daemon, the session is aborted whenever
the control or data connection encounters an error. Aborting
a session causes the streams to be closed regardless of the
fact that data is in-flight.

Currently, only the control connection holds an ownership of
the session object. This can cause the following scenario to leak
streams:

1) Control connection receives an index
  - Stream is put in "in-flight data" mode
2) Control connection is closed/shutdown cleanly
  - try_stream_close refuses to close the stream as data is in-flight,
    but it puts the stream in "closed" mode. When the data is
    received, the stream will be closed as soon as possible.
3) Data connection closes cleanly or due to an error
  - The stream "closing" condition will never be re-evaluated.

Since the data connection has no ownership of the session, it can
never clean-up the streams that are waiting for "in-flight" data to
arrive before closing.

This patch lazily associates the data connection to its session
so that the session can be aborted whenever an error happens on
either the data or control connection.

Note that this leaves the relayd vulnerable to a case which will
still leak. If the control connection receives an index and closes
cleanly, the data connection could have never been established
with the consumer daemon and result in a leak.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport: Port dynamic buffer to stable 2.9
Michael Jeanson [Fri, 27 Apr 2018 21:27:29 +0000 (17:27 -0400)] 
Backport: Port dynamic buffer to stable 2.9

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 years agoUpdate version to v2.9.10
Jérémie Galarneau [Tue, 24 Jul 2018 00:19:29 +0000 (20:19 -0400)] 
Update version to v2.9.10

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>
5 years agoFix: calling ht_{hash, match}_enum with wrong argument
Francis Deslauriers [Fri, 9 Feb 2018 21:56:49 +0000 (16:56 -0500)] 
Fix: calling ht_{hash, match}_enum with wrong argument

ht_hash_enum and ht_match_enum are currently called with the address of the
pointer to a ust_registry_enum rather than the expected pointer to a
ust_registry_enum. This means that those function calls would end up
using garbage for hashing and comparing.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: probes should be compared strictly by events metadata
Francis Deslauriers [Fri, 9 Feb 2018 21:56:48 +0000 (16:56 -0500)] 
Fix: probes should be compared strictly by events metadata

Currently, events are compared using names and signatures. Events
with different payloads but identical name and signatures could
lead to corrupted trace because the Session Daemon would consider them
identical and give them the same event ID.

Events should be compared using the name, loglevel, fields and
model_emf_uri to ensure that their respective metadata is the same.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: test_ust-dl is generated at configure-time
Francis Deslauriers [Tue, 6 Feb 2018 17:04:27 +0000 (12:04 -0500)] 
Fix: test_ust-dl is generated at configure-time

This file should not be in EXTRA_DIST as it's generated by autoconf and
will thus be available directly in the out-of-tree build directory.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: perform the initialization memory barrier out of loop body
Jérémie Galarneau [Fri, 18 May 2018 19:08:14 +0000 (15:08 -0400)] 
Fix: perform the initialization memory barrier out of loop body

The memory barrier used by the client thread should be performed
after the lttng_sessiond_ready counter has been seen to have
reached zero.

This ensures that loads are not speculatively performed before
this point as the thread will interact with data structures
initialized by the support threads for which it was waiting for
the initialization to complete.

See the comment as to why this read barrier is promoted to a
full barrier.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoPort: fix format warnings on Cygwin
Michael Jeanson [Tue, 15 May 2018 20:19:49 +0000 (16:19 -0400)] 
Port: fix format warnings on Cygwin

On Cygwin, be64toh() returns a "long long unsigned int" while the
format specifier PRIu64 expects a "long unsigned int". Both types
are 64bits integers, just cast the result to uint64_t to silence
the warnings.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: don't wait for the load thread before serving client commands
Jérémie Galarneau [Wed, 16 May 2018 21:08:36 +0000 (17:08 -0400)] 
Fix: don't wait for the load thread before serving client commands

Since the session loading thread uses the same communication than
the external clients, it should not be included in the set of
threads that must be launched before the sessiond starts to serve
client commands.

Since the "load session" thread is guaranteed to be the last
essential thread to be initialized, it can explicitly signal
the parents that the sessiond is ready once it is done auto-loading
session configurations.

This commit also adds a lengthy comment explaining the initialization
of the session daemon.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: sessiond fails to launch on --without-ust configuration
Jérémie Galarneau [Wed, 9 May 2018 01:26:15 +0000 (21:26 -0400)] 
Fix: sessiond fails to launch on --without-ust configuration

The sessiond will never signal that it is ready (in daemonize or
background modes) if it was built without lttng-ust. The fix in
7eac7803 made the main thread wait for the agent thread to be
ready before signalling that the session daemon is ready.

When agent tracing is not possible due to the absence of lttng-ust,
a stub function is used to launch the agent thread. This stub
must call sessiond_notify_ready() in order to unblock the main
thread.

Note that it would be _incorrect_ to not wait for the agent
thread to be launched as users expect all tracing features to
be available as soon as 'lttng-sessiond --daemonize/--background'
returns.

Not waiting for the thread to be ready caused very rare failures
of the agent tracing tests on the CI, especially on ARM and
PowerPC targets.

Reported-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: agent thread poll set creation failure results in deadlock
Jérémie Galarneau [Wed, 9 May 2018 01:23:14 +0000 (21:23 -0400)] 
Fix: agent thread poll set creation failure results in deadlock

Failing to initialize the agent thread's pollset will cause
the thread to exit before calling sessiond_notify_ready().

This will cause the main thread to wait forever for all threads
to be launched when such an error occurs.

The agent thread is not needed for the sessiond to work (except
to enable the tracing of Java and Python applications). Such
a failure should leave the sessiond in a useable state.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: test uses sizeof() on the wrong operand of strncpy
Jérémie Galarneau [Wed, 9 May 2018 01:22:36 +0000 (21:22 -0400)] 
Fix: test uses sizeof() on the wrong operand of strncpy

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoUpdate version to v2.9.9
Jérémie Galarneau [Mon, 30 Apr 2018 17:50:02 +0000 (13:50 -0400)] 
Update version to v2.9.9

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoAdd DBG statement for TCP keep-alive options
Jonathan Rajotte [Mon, 9 Apr 2018 14:23:33 +0000 (10:23 -0400)] 
Add DBG statement for TCP keep-alive options

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: failure to launch agent thread is not reported
Jérémie Galarneau [Mon, 23 Apr 2018 23:03:16 +0000 (19:03 -0400)] 
Fix: failure to launch agent thread is not reported

A session daemon may fail to launch its agent thread. In such
a case, the tracing of agent domains fails silently as events
never get enabled through the agent.

The problem that was reported was caused by a second session
daemon being already bound on the agent TCP socket port, which
prevented the launch of the agent thread.

While in this situation tracing is still not possible, the user
will at least get an error indicating as such when enabling
an event in those domains.

Reported-by: Deborah Barnard <starfallprojects@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: agent may not be ready on launch
Jérémie Galarneau [Mon, 23 Apr 2018 20:36:25 +0000 (16:36 -0400)] 
Fix: agent may not be ready on launch

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: lttng logs nanoseconds
Julien Desfossez [Fri, 10 Nov 2017 21:21:46 +0000 (16:21 -0500)] 
Fix: lttng logs nanoseconds

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: stream_per_chan_id_ht should allow duplicates
Julien Desfossez [Fri, 10 Nov 2017 21:22:13 +0000 (16:22 -0500)] 
Fix: stream_per_chan_id_ht should allow duplicates

Fixes: #1134
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: relayd send_command() util not logging on failure
Jérémie Galarneau [Tue, 6 Mar 2018 16:35:23 +0000 (11:35 -0500)] 
Fix: relayd send_command() util not logging on failure

send_command() only logs if it succeeds in sending a command to
the relay daemon.

This commit makes the helper log _before_ sending the command
so that errors can be associated back to the command being sent.
Moreover, PERROR() is used to log errors returned by sendmsg().

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: kernel snapshot handling of EAGAIN
Julien Desfossez [Mon, 11 Dec 2017 21:11:09 +0000 (16:11 -0500)] 
Fix: kernel snapshot handling of EAGAIN

kernctl_snapshot can return EAGAIN, this is not an error, it only means
there is no data to read.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix validate_trace_empty test check
Julien Desfossez [Thu, 21 Dec 2017 20:28:56 +0000 (15:28 -0500)] 
Fix validate_trace_empty test check

Since the output of babeltrace was directly piped into wc, the return
code was never an error even if the trace was invalid. We now split the
commands in two parts: process the trace with babeltrace and check the
error code, and then count the number of lines.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: hold consumer socket lock for consumer_send_msg
Jonathan Rajotte [Tue, 10 Apr 2018 17:56:47 +0000 (13:56 -0400)] 
Fix: hold consumer socket lock for consumer_send_msg

The lock is held and released during the recv() section, but not
during the send section for a failure to lookup the PID registry.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: use off_t type for lseek function return value to avoid overflow
Gregory LEOCADIE [Thu, 29 Mar 2018 10:52:30 +0000 (12:52 +0200)] 
Fix: use off_t type for lseek function return value to avoid overflow

Context: LTTng is configured in live mode with only one channel, getting
traces for a long-running application (days of uptime)

The trace file gets bigger (many GBs), so the offset (bigger than
int.MaxValue). When getting a packet for such offset, the lseek returns
bigger than int.MaxValue. This value is stored in a variable "ret" of
type int. We have an overflow which leads to sending an error to the
viewer (babeltrace), which stops.
[error] get_data_packet: error.
[error] get_data_packet failed
[error] Unknown return code 0

Signed-off-by: Gregory LEOCADIE <g.leocadie@criteo.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoUpdate version to v2.9.8
Jérémie Galarneau [Mon, 26 Mar 2018 15:36:04 +0000 (11:36 -0400)] 
Update version to v2.9.8

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: set errno with value from SO_ERROR on error.
Jonathan Rajotte [Wed, 21 Feb 2018 03:06:31 +0000 (22:06 -0500)] 
Fix: set errno with value from SO_ERROR on error.

Debugging output at the same time in case of asynchronous handling.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 years agoFix: missing value handling for lttng_event_context_type
Jonathan Rajotte [Mon, 26 Feb 2018 21:03:02 +0000 (16:03 -0500)] 
Fix: missing value handling for lttng_event_context_type

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: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.046828 seconds and 5 git commands to generate.