lttng-tools.git
8 years agoImplement lttng_strncpy safe string copy
Mathieu Desnoyers [Tue, 17 May 2016 01:42:40 +0000 (21:42 -0400)] 
Implement lttng_strncpy safe string copy

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: loading a session prints an error message but the load is successful
Jérémie Galarneau [Mon, 16 May 2016 16:10:19 +0000 (12:10 -0400)] 
Fix: loading a session prints an error message but the load is successful

Fixes #1013

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoSnapshot warning if there are no events in one of the domains
Jérémie Galarneau [Mon, 16 May 2016 05:20:47 +0000 (01:20 -0400)] 
Snapshot warning if there are no events in one of the domains

Remove the "no data" check from the UST snapshot code since

1) It would report that no data was recorded in the snapshot even
   if the kernel tracer had recorded events,
2) The kernel consumer does not seem to report such a condition,
   making it hard to perform the check without modifying the
   consumer.

The consumer interfaces could be modified to reliably provide
this information in the future.

However, this warning is not provided in the other tracing
modes, making its usefulness questionable. An empty snapshot is
still a valid trace and users should not always expect a trace
to contain events. Moreover, "warning" that no data was produced
implies an error may have occured and is probably as confusing
as opening an empty trace to the average user.

Fixes #1012

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoSnapshot: record: use same datetime for snapshot folder output
Jonathan Rajotte [Fri, 13 Nov 2015 15:36:47 +0000 (10:36 -0500)] 
Snapshot: record: use same datetime for snapshot folder output

Make sure that the ust snapshot is put under the same folder as the
kernel snapshot.

Fixes #970

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoRefactor: move the snapshot type check into output type check
Jonathan Rajotte [Fri, 13 Nov 2015 15:30:01 +0000 (10:30 -0500)] 
Refactor: move the snapshot type check into output type check

Since for both sub-session type the boilerplate is the same
simply move the check for sub-session type presence to the inner
check of type output.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoconfigure.ac: check for an existing liburcu-cds symbol
Philippe Proulx [Tue, 10 May 2016 20:00:28 +0000 (16:00 -0400)] 
configure.ac: check for an existing liburcu-cds symbol

Fixes #1001

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoconfigure.ac: use macro for wrong liburcu error message
Philippe Proulx [Tue, 10 May 2016 19:51:17 +0000 (15:51 -0400)] 
configure.ac: use macro for wrong liburcu error message

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTests: wording of trace_matches is misleading
Jérémie Galarneau [Sat, 14 May 2016 20:27:20 +0000 (16:27 -0400)] 
Tests: wording of trace_matches is misleading

trace_matches reports a number of "events found" in a trace while it
actually counts the number of event_name matches.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTypo: catched -> caught
Michael Jeanson [Tue, 19 Apr 2016 20:34:55 +0000 (16:34 -0400)] 
Typo: catched -> caught

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: free ust channel object after grace period in consumer
Mathieu Desnoyers [Wed, 27 Apr 2016 20:28:02 +0000 (16:28 -0400)] 
Fix: free ust channel object after grace period in consumer

[ Backport from master branch
commit b83e03c499 "Fix: free metadata cache after grace period in consumer" ]

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTest fix: ignore stderr at every step of randstring
Jérémie Galarneau [Wed, 9 Mar 2016 20:49:24 +0000 (15:49 -0500)] 
Test fix: ignore stderr at every step of randstring

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoUpdate version to v2.6.2 v2.6.2
Jérémie Galarneau [Tue, 19 Apr 2016 18:29:02 +0000 (14:29 -0400)] 
Update version to v2.6.2

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: add missing synchronization point for before app test case
Mathieu Desnoyers [Thu, 20 Nov 2014 06:40:41 +0000 (07:40 +0100)] 
Fix: add missing synchronization point for before app test case

Fixes a race where the application could generate all its events before
trace start.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix warning when building Python bindings
Jérémie Galarneau [Tue, 23 Feb 2016 20:18:18 +0000 (15:18 -0500)] 
Fix warning when building Python bindings

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTests: use configured processor count in tracefile count test
Michael Jeanson [Tue, 15 Mar 2016 20:13:26 +0000 (16:13 -0400)] 
Tests: use configured processor count in tracefile count test

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTests: use configured processor count in snapshot tests
Jérémie Galarneau [Tue, 15 Mar 2016 20:13:25 +0000 (16:13 -0400)] 
Tests: use configured processor count in snapshot tests

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTests: Introduce conf_proc_count()
Jérémie Galarneau [Tue, 15 Mar 2016 20:13:24 +0000 (16:13 -0400)] 
Tests: Introduce conf_proc_count()

Tests are using the nproc utility which return the number of
_available_ CPUs. The distinction between online, available and
configured CPUs is subtle, but important.

The number of "online" CPUs can change at runtime as CPUs are
hot-plugged. This could happen during a test and result in
unexpected results.

The number of "configured" CPUs includes any CPU which may be
offline at the time.

The number of "available" CPUs, which is what is returned by the
nproc utility, may differ from both "online" and "configured"
counts. This is the case in containers which are assigned to a
subset of configured CPUs.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTest: prevent the spawning of a daemonized sessiond
Jonathan Rajotte [Tue, 8 Mar 2016 22:37:39 +0000 (17:37 -0500)] 
Test: prevent the spawning of a daemonized sessiond

Sets the default lttng-sessiond path to /bin/true to prevent the spawning
of a daemonized sessiond. This is necessary since 'lttng create' will spawn
its own sessiond if none is running. It also ensures that 'lttng create'
fails when no sessiond is running.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: do not print error and bug messages when quiet (-q) is present
Jonathan Rajotte [Mon, 11 Jan 2016 22:32:14 +0000 (17:32 -0500)] 
Fix: do not print error and bug messages when quiet (-q) is present

Conform to the lttng man page

fixes #988

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoBuild: fallback to AC_CHECK_LIBS when looking for popt and uuid
Jonathan Rajotte [Tue, 1 Dec 2015 20:19:01 +0000 (15:19 -0500)] 
Build: fallback to AC_CHECK_LIBS when looking for popt and uuid

Not all distro ship .pc so fallback to basic libs searching if necessary.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agotests/unit: fix object files' location
Samuel Martin [Tue, 1 Dec 2015 23:36:45 +0000 (00:36 +0100)] 
tests/unit: fix object files' location

Referring to *.o files under a .libs/ directory is not recommended
because this belongs to libtool's innards.

Indeed, libtool decides to place the *.o files in an
implementation-specific location:
- PIC *.o files go into a .libs/ directory;
- non-PIC *.o files are generated along side to their corresponding
  source files.

Using PIC objects to build executable is legit, thought it may
introduce some minor overhead at runtime.

However, hard-coding these PIC object files in the Makefile.am to build
executables breaks the build in case of static only build.

In this case, no PIC object files is generated, so the linker will not
found some of the needed objects files.

Changing these dependencies' path fixes the static build, keeping the
shared one ok, though the non-PIC object files are now always built.

Fixes #983.

Fix tested on git master and v2.6 with no change needed.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoconfigure.ac: fix static build
Samuel Martin [Sun, 22 Nov 2015 22:38:00 +0000 (23:38 +0100)] 
configure.ac: fix static build

For static build, some extra LDFLAGS may be needed.

Using PKG_CHECK_MODULES instead of AC_CHECK_LIB for librairy detection
allows to get all these flags. Then, the LIBS variable can be extended
with everything that is needed.

So, use PKG_CHECK_MODULES for popt and uuid detection; which both depend
on libintl.

This changes fixes build failures triggered with Buildroot, e.g.:
  http://autobuild.buildroot.net/results/0f1/0f1e015a0c5a5ac2beeb5011d31a1e0058a32a0d/build-end.log

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: close indexes when rotating the trace files in mmap mode
Jérémie Galarneau [Fri, 27 Nov 2015 20:47:01 +0000 (15:47 -0500)] 
Fix: close indexes when rotating the trace files in mmap mode

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: close indexes when rotating the trace files in splice mode
Julien Desfossez [Fri, 27 Nov 2015 17:12:44 +0000 (12:12 -0500)] 
Fix: close indexes when rotating the trace files in splice mode

The consumer needs to close the old index file when doing a file
rotation before opening a new one.
The relay does not have this problem (handled with refcounts).

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: use liburcu flavor header instead of local copy
Mathieu Desnoyers [Wed, 28 Oct 2015 19:55:58 +0000 (15:55 -0400)] 
Fix: use liburcu flavor header instead of local copy

The layout of struct rcu_flavor_struct has changed in newer URCU
versions. There is no need to keep a local copy of this structure. Use
the library header instead.

This ensures that the caller of _cds_lfht_new(), which passes a flavor
pointer with the library layout defined by liburcu, has the same layout
expected internally within the local copy of rculfhash.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: rculfhash should not include specific rcu flavor
Mathieu Desnoyers [Wed, 28 Oct 2015 19:55:57 +0000 (15:55 -0400)] 
Fix: rculfhash should not include specific rcu flavor

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix live timer calculation error
Mikael Beckius [Wed, 21 Oct 2015 19:48:29 +0000 (15:48 -0400)] 
Fix live timer calculation error

There is an calculation error for live timer. Variable
switch_timer_interval is based on microsecond, and it is not
right to assign switch_timer_interval mod 1000000 to var tv_nsec
which is based on nanosecond.

Signed-off-by: Mikael Beckius <mikael.beckius@windriver.com>
Signed-off-by: Jianchuan Wang <jianchuan.wang@windriver.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoUpdate version to v2.6.1 v2.6.1
Jérémie Galarneau [Thu, 24 Sep 2015 19:29:39 +0000 (15:29 -0400)] 
Update version to v2.6.1

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoRevert "Fix: add missing test file to EXTRA_DIST"
Jérémie Galarneau [Thu, 24 Sep 2015 19:28:54 +0000 (15:28 -0400)] 
Revert "Fix: add missing test file to EXTRA_DIST"

This reverts commit fb7d878577570de1470d891757abad9f078ebeec.

9 years agoFix: regression tests
Mathieu Desnoyers [Thu, 24 Sep 2015 16:23:58 +0000 (12:23 -0400)] 
Fix: regression tests

Fix racy session/relayd wait-after-kill scheme.
Fix racy live test where application may not have generated events yet
when we attach to the live trace.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: tests: stderr not correctly redirected
Jonathan Rajotte [Thu, 24 Sep 2015 16:23:57 +0000 (12:23 -0400)] 
Fix: tests: stderr not correctly redirected

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoHelp: add -j -l -p option to help string
Jonathan Rajotte [Mon, 21 Sep 2015 22:43:57 +0000 (18:43 -0400)] 
Help: add -j -l -p option to help string

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: Only log app handle release on failure
Jérémie Galarneau [Fri, 18 Sep 2015 19:35:21 +0000 (15:35 -0400)] 
Fix: Only log app handle release on failure

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: prevent dangling pointer in utils_partial_realpath
Antoine Busque [Wed, 16 Sep 2015 06:58:40 +0000 (02:58 -0400)] 
Fix: prevent dangling pointer in utils_partial_realpath

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: rcu_read_unlock without parentheses has no side-effect
Jérémie Galarneau [Wed, 16 Sep 2015 23:49:56 +0000 (19:49 -0400)] 
Fix: rcu_read_unlock without parentheses has no side-effect

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: add missing test file to EXTRA_DIST
Michael Jeanson [Tue, 15 Sep 2015 14:37:48 +0000 (10:37 -0400)] 
Fix: add missing test file to EXTRA_DIST

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: disable all ust events
Jonathan Rajotte [Thu, 10 Sep 2015 20:10:56 +0000 (16:10 -0400)] 
Fix: disable all ust events

Handle * event correctly.

Fixes #936

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: sessiond: disable: match app event by name
Jonathan Rajotte [Wed, 9 Sep 2015 21:08:20 +0000 (17:08 -0400)] 
Fix: sessiond: disable: match app event by name

The use of a simple lookup and match on event name is insufficient
to identify the corresponding ust app event.

Fixes #914

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: dereferencing null index pointer
Antoine Busque [Sun, 13 Sep 2015 05:13:38 +0000 (01:13 -0400)] 
Fix: dereferencing null index pointer

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: memleak in utils_partial_realpath
Antoine Busque [Sun, 13 Sep 2015 04:18:44 +0000 (00:18 -0400)] 
Fix: memleak in utils_partial_realpath

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: error on no/multiple domain options
Philippe Proulx [Wed, 2 Sep 2015 17:33:52 +0000 (13:33 -0400)] 
Fix: error on no/multiple domain options

Fixes: #927
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: relayd: handle consumerd crashes without leak
Mathieu Desnoyers [Wed, 9 Sep 2015 15:56:34 +0000 (11:56 -0400)] 
Fix: relayd: handle consumerd crashes without leak

We can be clever about indexes partially received in cases where we
received the data socket part, but not the control socket part: since
we're currently closing the stream on behalf of the control socket, we
*know* there won't be any more control information for this socket.
Therefore, we can destroy all indexes for which we have received only
the file descriptor (from data socket). This takes care of consumerd
crashes between sending the data and control information for a packet.
Since those are sent in that order, we take care of consumerd crashes.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: LPOLLHUP and LPOLLERR when there is still data in pipe/socket
Mathieu Desnoyers [Wed, 9 Sep 2015 15:56:33 +0000 (11:56 -0400)] 
Fix: LPOLLHUP and LPOLLERR when there is still data in pipe/socket

The event mask returned by poll/epoll is a bitwise mask made of all the
events observed. On bidirectional sockets, there are cases where
combinations of LPOLLHUP/LPOLLERR and LPOLLIN/LPOLLPRI can be raised at
the same time.

Currently the overall behavior in sessiond, consumerd and relayd is to
handle LPOLLHUP or LPOLLERR immediately, whether or not there is still
data to read in the socket. Unfortunately, this behavior may discard the
last information made available on the pipe or socket.

Audit all uses of LPOLLHUP and LPOLLERR on sockets on which we expect
data to ensure that we deal with LPOLLIN or LPOLLPRI, and catch the
hangup when read or recvmsg returns 0. Keep the LPOLLHUP and LPOLLERR
handling, but only when LPOLLIN is not raised, just in case some
unforeseen error happens when sending the reply.

This is one correct case where we can handle LPOLLHUP and LPOLLERR
directly without caring about LPOLLIN: sockets where we are expected to
write and then read the reply (e.g. command sockets). It is then OK
for a dedicated thread to watch for LPOLLHUP and LPOLLERR.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoRemove dot after enable-event message
Jérémie Galarneau [Sun, 6 Sep 2015 03:51:33 +0000 (23:51 -0400)] 
Remove dot after enable-event message

The other domains' enable event confirmation messages don't have
a trailing dot. Removing this one for consistency.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: don't print the default channel name when enabling agent events
Antoine Busque [Wed, 2 Sep 2015 00:21:00 +0000 (20:21 -0400)] 
Fix: don't print the default channel name when enabling agent events

Enabling an event in the python domain erroneously reported the
channel as being the default `channel0`. Instead, don't report the
channel name when enabling an event in an agent domain.

Fixes: #910
Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: fail gracefully on --exclude on unsupported domains
Antoine Busque [Tue, 1 Sep 2015 23:48:43 +0000 (19:48 -0400)] 
Fix: fail gracefully on --exclude on unsupported domains

Trying to use event name exclusions on unsupported domains other than
kernel (i.e. log4j, jul, and python) would hang the client. Instead,
report the error appropriately.

Fixes: #909
Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: initialize live_timer to 0 for snapshot session
Antoine Busque [Tue, 1 Sep 2015 23:12:28 +0000 (19:12 -0400)] 
Fix: initialize live_timer to 0 for snapshot session

The live timer was being initialized to -1 for snapshot sessions,
instead of the expected default value of 0 used elsewhere in the code.

Fixes #879

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: correct mismatched function signatures
Antoine Busque [Tue, 1 Sep 2015 22:53:57 +0000 (18:53 -0400)] 
Fix: correct mismatched function signatures

The extern declaration of `_lttng_create_session_ext` in `create.c`
had a superfluous `live_timer` parameter not present in the actual
function definition in `lttng_ctl.c`. The -1 value with which it was
called was therefore unused.

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: consumer signal handling race
Mathieu Desnoyers [Sat, 5 Sep 2015 23:58:29 +0000 (19:58 -0400)] 
Fix: consumer signal handling race

If a signal comes in after ctx has been destroyed, it will try to use a
closed file descriptor.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: list_ust_events(): dangling pointer
Philippe Proulx [Wed, 26 Aug 2015 17:40:18 +0000 (13:40 -0400)] 
Fix: list_ust_events(): dangling pointer

Fixes #908

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: Buggy string comparison in ust registry ht_match_event
Jérémie Galarneau [Sat, 5 Sep 2015 19:35:42 +0000 (15:35 -0400)] 
Fix: Buggy string comparison in ust registry ht_match_event

The second strncmp compares the first "strlen(event->signature) != 0"
characters of the event signatures because of a missing parenthesis.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: Overwrite of ret in relay_recv_metadata
Jérémie Galarneau [Sat, 5 Sep 2015 15:57:52 +0000 (11:57 -0400)] 
Fix: Overwrite of ret in relay_recv_metadata

relay_recv_metadata() interchangeably uses ret and size_ret.
This causes ret to take various (positive) values in case
of success, most often corresponding to the size of the metadata
padding which was written during the call.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: Wait for in-flight data before closing a stream
Jérémie Galarneau [Sat, 5 Sep 2015 02:04:12 +0000 (22:04 -0400)] 
Fix: Wait for in-flight data before closing a stream

A stream's closing conditions are evaluated in three places:
    1) When a close command is received
    2) When the control connection owning it is closed
    3) The stream has received all of its data following
       a close request.

These checks are performed in try_stream_close().

A known downside of this approach is that a stream will never
be closed if it has not received all of its data.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: unpublish stream on close
Mathieu Desnoyers [Fri, 4 Sep 2015 19:44:23 +0000 (15:44 -0400)] 
Fix: unpublish stream on close

Fixes a race where data connection can still add indexes after close,
preventing graceful teardown of the stream.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoTests: Fix flaky live test client
Jérémie Galarneau [Fri, 4 Sep 2015 01:45:10 +0000 (21:45 -0400)] 
Tests: Fix flaky live test client

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: Announce empty streams on live attach
Jérémie Galarneau [Fri, 4 Sep 2015 01:43:26 +0000 (21:43 -0400)] 
Fix: Announce empty streams on live attach

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: relayd: file rotation and live read
Mathieu Desnoyers [Thu, 3 Sep 2015 21:17:30 +0000 (17:17 -0400)] 
Fix: relayd: file rotation and live read

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: relay: viewer_get_next_index handle null vstream
Mathieu Desnoyers [Thu, 3 Sep 2015 21:17:29 +0000 (17:17 -0400)] 
Fix: relay: viewer_get_next_index handle null vstream

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: relayd: make viewer streams consider metadata sent
Mathieu Desnoyers [Thu, 3 Sep 2015 21:17:28 +0000 (17:17 -0400)] 
Fix: relayd: make viewer streams consider metadata sent

The metadata stream does not use prev seq, and is therefore not sent to
viewers if we depend on prev seq. Use the metadata_received field
instead to achieve the same purpose: if a viewer try to attach to a
session that has not received metadata yet, it will get and error
(metadata stream cannot be found when attaching).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: don't expose empty streams
Mathieu Desnoyers [Tue, 25 Aug 2015 18:49:34 +0000 (14:49 -0400)] 
Fix: don't expose empty streams

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: relayd: don't check new metadata on get packet
Mathieu Desnoyers [Thu, 3 Sep 2015 04:38:26 +0000 (00:38 -0400)] 
Fix: relayd: don't check new metadata on get packet

We only care about this when we get the next index. There may be new
metadata that appears between get next index and get packet, but it
should not matter.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: relayd: don't check for new streams in get packet
Mathieu Desnoyers [Tue, 25 Aug 2015 13:26:30 +0000 (09:26 -0400)] 
Fix: relayd: don't check for new streams in get packet

Only needed in get next index.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: ask new streams HUP
Mathieu Desnoyers [Tue, 25 Aug 2015 13:00:50 +0000 (09:00 -0400)] 
Fix: ask new streams HUP

Test closed streams for content to check for HUP.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: reply error if get packet vstream fails
Mathieu Desnoyers [Tue, 25 Aug 2015 11:53:07 +0000 (07:53 -0400)] 
Fix: reply error if get packet vstream fails

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: relayd reply error to client if cannot find viewer stream
Mathieu Desnoyers [Tue, 25 Aug 2015 11:47:08 +0000 (07:47 -0400)] 
Fix: relayd reply error to client if cannot find viewer stream

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: relayd reply with error if cannot find metadata
Mathieu Desnoyers [Tue, 25 Aug 2015 11:43:16 +0000 (07:43 -0400)] 
Fix: relayd reply with error if cannot find metadata

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: ust-app: protect app socket protocol with lock
Mathieu Desnoyers [Tue, 25 Aug 2015 02:50:09 +0000 (22:50 -0400)] 
Fix: ust-app: protect app socket protocol with lock

Many threads can access the application socket (cmd handling thread and
application handling thread) concurrently. Therefore, we need to protect
it with a mutex.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
 Conflicts:
src/bin/lttng-sessiond/ust-app.c

9 years agoFix: add missing rcu_barrier at end of sessiond main
Mathieu Desnoyers [Mon, 24 Aug 2015 19:03:35 +0000 (15:03 -0400)] 
Fix: add missing rcu_barrier at end of sessiond main

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
 Conflicts:
src/bin/lttng-sessiond/main.c

9 years agoFix: add missing rcu_barrier at end of consumer main
Mathieu Desnoyers [Mon, 24 Aug 2015 19:03:20 +0000 (15:03 -0400)] 
Fix: add missing rcu_barrier at end of consumer main

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
 Conflicts:
src/bin/lttng-consumerd/lttng-consumerd.c

9 years agoFix: app cmd leak on sessiond exit
Mathieu Desnoyers [Mon, 24 Aug 2015 18:41:42 +0000 (14:41 -0400)] 
Fix: app cmd leak on sessiond exit

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
 Conflicts:
src/bin/lttng-sessiond/main.c

9 years agoFix: relayd live don't send incomplete stream list
Mathieu Desnoyers [Sun, 23 Aug 2015 19:52:26 +0000 (12:52 -0700)] 
Fix: relayd live don't send incomplete stream list

Sample the "closed" flag with session lock held.
Also, if the session connection is closed while we attach to it, reply
with HUP, because there are risks of attaching to an incomplete session
(e.g. the metadata stream could be already closed).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: consumer timer misses RCU thread registration
Mathieu Desnoyers [Sun, 23 Aug 2015 15:58:50 +0000 (08:58 -0700)] 
Fix: consumer timer misses RCU thread registration

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: sessiond consumer thread should register as RCU thread
Mathieu Desnoyers [Sun, 23 Aug 2015 05:01:36 +0000 (22:01 -0700)] 
Fix: sessiond consumer thread should register as RCU thread

Fixes RCU race where objects are accessed by this thread under RCU
read-side lock after free. Since this thread is not a registered RCU
reader, the read-side lock has no effect.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: don't chain RCU free
Mathieu Desnoyers [Sun, 23 Aug 2015 03:14:44 +0000 (20:14 -0700)] 
Fix: don't chain RCU free

We only do a single rcu_barrier() on teardown of sessiond. Therefore, if
we chain call_rcu, they may not all be executed before exit.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: sessiond vs consumerd push/get metadata deadlock
Mathieu Desnoyers [Wed, 19 Aug 2015 21:44:59 +0000 (14:44 -0700)] 
Fix: sessiond vs consumerd push/get metadata deadlock

We need to unlock the registry while we push metadata to break a
circular dependency between the consumerd metadata lock and the sessiond
registry lock. Indeed, pushing metadata to the consumerd awaits that it
gets pushed all the way to relayd, but doing so requires grabbing the
metadata lock. If a concurrent metadata request is being performed by
consumerd, this can try to grab the registry lock on the sessiond while
holding the metadata lock on the consumer daemon. Those push and pull
schemes are performed on two different bidirectionnal communication
sockets.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: sessiond vs consumerd push/get metadata deadlock
Mathieu Desnoyers [Wed, 19 Aug 2015 21:44:59 +0000 (14:44 -0700)] 
Fix: sessiond vs consumerd push/get metadata deadlock

We need to unlock the registry while we push metadata to break a
circular dependency between the consumerd metadata lock and the sessiond
registry lock. Indeed, pushing metadata to the consumerd awaits that it
gets pushed all the way to relayd, but doing so requires grabbing the
metadata lock. If a concurrent metadata request is being performed by
consumerd, this can try to grab the registry lock on the sessiond while
holding the metadata lock on the consumer daemon. Those push and pull
schemes are performed on two different bidirectionnal communication
sockets.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: streamline ret/errno of run_as()
Mathieu Desnoyers [Wed, 19 Aug 2015 21:13:48 +0000 (14:13 -0700)] 
Fix: streamline ret/errno of run_as()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
 Conflicts:
src/bin/lttng-sessiond/ust-registry.c
src/common/runas.c
src/common/ust-consumer/ust-consumer.c

9 years agoFix: Double unlock on error path
Mathieu Desnoyers [Thu, 3 Sep 2015 03:01:21 +0000 (23:01 -0400)] 
Fix: Double unlock on error path

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: Relay daemon ownership and reference counting
Mathieu Desnoyers [Thu, 3 Sep 2015 02:57:40 +0000 (22:57 -0400)] 
Fix: Relay daemon ownership and reference counting

The ownership and reference counting of the relay daemon is unclear and
buggy in many ways. It is the cause of memory corruptions, double-free,
leaks, segmentation faults, observed in various conditions.

Fix this situation by introducing a clear ownership and reference
counting scheme for this daemon.

See doc/relayd-architecture.txt for details.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
 Conflicts:
src/bin/lttng-relayd/ctf-trace.c
src/bin/lttng-relayd/lttng-relayd.h
src/bin/lttng-relayd/main.c

9 years agoAdd run_as_unlink implementation
Jérémie Galarneau [Thu, 24 Sep 2015 01:47:13 +0000 (21:47 -0400)] 
Add run_as_unlink implementation

run_as_unlink() is used by
Fix: Relay daemon ownership and reference counting

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoCleanup: Reduce scope of relayd connections in live thread
Jérémie Galarneau [Fri, 27 Feb 2015 16:34:04 +0000 (11:34 -0500)] 
Cleanup: Reduce scope of relayd connections in live thread

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: Remove structurally dead code from relayd
Jérémie Galarneau [Thu, 8 Jan 2015 23:06:20 +0000 (18:06 -0500)] 
Fix: Remove structurally dead code from relayd

CID 1262070:  Structurally dead code  (UNREACHABLE)

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoCleanup: relayd: centralize thread stopping function
Mathieu Desnoyers [Thu, 18 Dec 2014 18:02:07 +0000 (13:02 -0500)] 
Cleanup: relayd: centralize thread stopping function

Rather than relying on having main.c and live.c threads both using the
same notification pipe from different stop_thread implementations,
centralize thread stop in one central function exposed to both main.c
and live.c

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoRefactor relayd main/set_options/cleanup
Mathieu Desnoyers [Thu, 18 Dec 2014 01:45:24 +0000 (20:45 -0500)] 
Refactor relayd main/set_options/cleanup

- Enforce symmetry between allocation and teardown,
- Handle all errors,
- Return all errors as EXIT_FAILURE,
- Standardize on zero being success, nonzero being error,
  (rather than < 0 being error),
- Fix pthread PERROR: we need to store ret into errno before
  calling PERROR, since pthread API does not set errno,
- Join errors now fall-through, rather than rely on the OS
  to teardown the rest.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoCleanup: spaghetti function return path
Mathieu Desnoyers [Fri, 21 Nov 2014 17:36:36 +0000 (18:36 +0100)] 
Cleanup: spaghetti function return path

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoAccept uid and gid parameters in utils_mkdir()/utils_mkdir_recursive()
Jérémie Galarneau [Thu, 3 Sep 2015 19:09:00 +0000 (15:09 -0400)] 
Accept uid and gid parameters in utils_mkdir()/utils_mkdir_recursive()

utils_mkdir* utils may now be use in immediate or "run_as" mode.

This is done since some of the code shared between daemons calls
run_as directly, which doesn't support negative uid/gid (which we use
to mean "run as current user").

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: reference counting of consumer output
Mathieu Desnoyers [Wed, 19 Aug 2015 07:29:52 +0000 (00:29 -0700)] 
Fix: reference counting of consumer output

The UST app session has a reference on the consumer output object, but
it belongs to the UST session. Implement a refcounting scheme to ensure
it is not freed before all users are done using it.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: sessiond add missing socket close
Mathieu Desnoyers [Tue, 18 Aug 2015 01:47:53 +0000 (18:47 -0700)] 
Fix: sessiond add missing socket close

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: sessiond should not error on channel creation vs app exit
Mathieu Desnoyers [Sun, 16 Aug 2015 21:56:57 +0000 (17:56 -0400)] 
Fix: sessiond should not error on channel creation vs app exit

We should not report an error when creating a channel if the application
is exiting concurrently.

Also, remove an inappropriate assert() in ust_app_create_event_glb: it
is possible to have a channel lookup fail if channel/event creation
occurs concurrently with an application exit.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: sessiond ust-app session teardown race
Mathieu Desnoyers [Sun, 16 Aug 2015 21:10:22 +0000 (17:10 -0400)] 
Fix: sessiond ust-app session teardown race

Add a deleted flag within the ust app session which is raised (with ust
app session lock held) at delete, and checked within each RCU traversal,
again with ust app session lock held.

This takes care of races between teardown of an application (unregister)
and execution of commands which are accessing the app session
concurrently.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoInitialize default log level of events on load
Jérémie Galarneau [Mon, 31 Aug 2015 22:53:51 +0000 (18:53 -0400)] 
Initialize default log level of events on load

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: Memory leak of agent
Jérémie Galarneau [Sun, 30 Aug 2015 22:50:39 +0000 (18:50 -0400)] 
Fix: Memory leak of agent

agent_destroy() has a comment which indicates that it does _not_
destroy the pointer passed to it and it seems that agents are
never realeased under any code path whatsoever.

There does not seem to be an instance where an agent is allocated on
the stack.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: Memory leak of agent event internals
Jérémie Galarneau [Sun, 30 Aug 2015 22:32:47 +0000 (18:32 -0400)] 
Fix: Memory leak of agent event internals

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: UTF-8 characters may be stored on up to 4 bytes
Jérémie Galarneau [Sun, 30 Aug 2015 21:43:45 +0000 (17:43 -0400)] 
Fix: UTF-8 characters may be stored on up to 4 bytes

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoDon't save log level in session configuration when unneeded
Jérémie Galarneau [Fri, 28 Aug 2015 18:53:26 +0000 (14:53 -0400)] 
Don't save log level in session configuration when unneeded

Saving the log level of events in session configurations when "ALL" log
levels are enabled may confuse both users and programs working with
session configurations.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: typo in error message
Jérémie Galarneau [Wed, 26 Aug 2015 16:04:12 +0000 (12:04 -0400)] 
Fix: typo in error message

writting -> writing

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoAdd agent domains to lttng enable-event usage()
Jérémie Galarneau [Wed, 26 Aug 2015 16:03:38 +0000 (12:03 -0400)] 
Add agent domains to lttng enable-event usage()

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoReport memory allocation failure when copying filter bytecode
Jérémie Galarneau [Wed, 26 Aug 2015 16:00:30 +0000 (12:00 -0400)] 
Report memory allocation failure when copying filter bytecode

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoFix: cmd_enable_event must return positive error codes
Jérémie Galarneau [Wed, 26 Aug 2015 16:00:05 +0000 (12:00 -0400)] 
Fix: cmd_enable_event must return positive error codes

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 years agoSave filter expressions as part of agent events
Jérémie Galarneau [Wed, 26 Aug 2015 15:37:48 +0000 (11:37 -0400)] 
Save filter expressions as part of agent events

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