lttng-tools.git
11 years agoUpdate version to v2.1.0-rc7 v2.1.0-rc7
David Goulet [Tue, 13 Nov 2012 18:44:38 +0000 (13:44 -0500)] 
Update version to v2.1.0-rc7

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: remove temporary directory for valid filters test
David Goulet [Tue, 13 Nov 2012 18:44:02 +0000 (13:44 -0500)] 
Fix: remove temporary directory for valid filters test

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Add pointer check when freeing poll events
David Goulet [Fri, 9 Nov 2012 20:28:06 +0000 (15:28 -0500)] 
Fix: Add pointer check when freeing poll events

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: FD leak on thread error
David Goulet [Fri, 9 Nov 2012 20:23:48 +0000 (15:23 -0500)] 
Fix: FD leak on thread error

Also, don't spawn the kernel thread if not root and the no-kernel option
is set.

Fixes #316

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Wrong fd used by kernel_wait_quiescent
David Goulet [Fri, 9 Nov 2012 18:52:39 +0000 (13:52 -0500)] 
Fix: Wrong fd used by kernel_wait_quiescent

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoSupport new lttng-ust error code
David Goulet [Fri, 9 Nov 2012 18:37:25 +0000 (13:37 -0500)] 
Support new lttng-ust error code

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Don't set filter if enable event fails
David Goulet [Fri, 9 Nov 2012 18:36:02 +0000 (13:36 -0500)] 
Fix: Don't set filter if enable event fails

Furthermore, the session daemon now returns an already exist error if
the event is enabled twice. Since we can now set filter, it's misleading
the user to tell him/her that the event was enabled but the filter
failed and than disabling the already enabled event by a previous
command.

Fixes #363 #364

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Wrong data port when listing session
David Goulet [Fri, 9 Nov 2012 16:36:51 +0000 (11:36 -0500)] 
Fix: Wrong data port when listing session

Fixes #377

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Enable event after start command
David Goulet [Thu, 8 Nov 2012 19:08:28 +0000 (14:08 -0500)] 
Fix: Enable event after start command

Refer to the bug tracker for more information on this bug. In a
nutshell, it was not possible to enable channel/event after a start
command has been issued (for both kernel and UST).

Note that it is still NOT possible to enable a channel after a start but
the use case here was the following:

$ lttng create
$ lttng start
$ lttng enable-event -a -u (or -k)

The first starts does NOT create a kernel or UST session so the
following enable event creates the session for the given domain but
failed to start the session after.

https://bugs.lttng.org/issues/346
https://bugs.lttng.org/issues/394

Fixes #346 #394

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Teardown of thread_manage_clients on failure of listen/create_poll
Christian Babeux [Thu, 8 Nov 2012 19:19:51 +0000 (14:19 -0500)] 
Fix: Teardown of thread_manage_clients on failure of listen/create_poll

Currently, if the call to lttcomm_listen_unix_sock or
create_thread_poll_set fails, the error handling and thread teardown
code path is triggered via a jump to an error label. This error handling
path closes the sockets that were used and cleanup the poll set. If the
listen fails, the poll set will tentatively be cleaned even though it
has never been initialized.

This patch add 2 labels to differentiate the error handling paths needed
in case of failure of lttcomm_listen_unix_sock or
create_thread_poll_set.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoAdd a timeout to UST application socket
David Goulet [Thu, 1 Nov 2012 15:24:22 +0000 (11:24 -0400)] 
Add a timeout to UST application socket

By default, a 5 seconds timeout is set on every UST application socket
just after the accept() for both recv and send operation.

This value can be changed through a new environment variable (seconds)
of the session daemon.

This is the first step to fix bug386 where a stopped application can
stalls indefinitely the session daemon when a new command is sent.

The bug 386 is also fixed with the lttng-ust commit:
7bc53e94a229963972aa78880b361b1510fdd268

Fixes #386

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoRevert "Fix cross-compile"
David Goulet [Wed, 7 Nov 2012 20:32:13 +0000 (15:32 -0500)] 
Revert "Fix cross-compile"

This reverts commit 5692e22beeb7119d68055d6450b924972b5f20d0.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix cross-compile
Mathieu Desnoyers [Wed, 7 Nov 2012 20:13:21 +0000 (15:13 -0500)] 
Fix cross-compile

configure.ac should use --target, not --host to get the target info we
want to compile for. --host is for the host that does the build.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Consumerd error socket connect race
David Goulet [Tue, 6 Nov 2012 20:55:58 +0000 (15:55 -0500)] 
Fix: Consumerd error socket connect race

Fixes #366

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Set CLOEXEC flag on every created sockets
David Goulet [Wed, 31 Oct 2012 19:12:00 +0000 (15:12 -0400)] 
Fix: Set CLOEXEC flag on every created sockets

Every new socket created by an accept() in the session daemon is set
with the CLOEXEC flag so when the consumer is spawned we don't leak.

Fixes #367

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoRemove consumer poll timeout in data thread
David Goulet [Tue, 6 Nov 2012 15:18:26 +0000 (10:18 -0500)] 
Remove consumer poll timeout in data thread

This was originally used to stop any poll() after a grace period when a
session daemon dies in case of weird stuck fd(s).

However, things have changed a bit especially on the UST tracer side
where all stream handles are now cleaned up if the session daemon socket
hang up which than release every stream on the consumer and finally
quits gracefully.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: RCU hash table seed
David Goulet [Tue, 6 Nov 2012 20:21:18 +0000 (15:21 -0500)] 
Fix: RCU hash table seed

Remove the dangerous static value 0x42UL. Use time(NULL) value to set
the new lttng_ht_seed variable when the hash table library constructor
is called.

Fixes #388

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Do not install health tests helper libraries
Christian Babeux [Tue, 6 Nov 2012 18:32:05 +0000 (13:32 -0500)] 
Fix: Do not install health tests helper libraries

The libraries libhealthexit and libhealthstall should not be installed
on the user system. They are only useful for the health check tests.

Furthermore, when adding libraries to noinst_LTLIBRARIES, libtool will
only build these as static libraries (see [1] for a workaround). This is
fine for most use cases, but for the health tests, we _must_ have shared
libraries (the nature of the tests require LD_PRELOAD), hence we force
the build of a shared object.

Forcing shared object has the unfortunate side-effect of breaking builds
where configure was invoked with "--disable-shared" flag.  Instead of
failing badly, detect this flag and skip the health tests altogether.

noinst shared libs:
[1] - https://lists.gnu.org/archive/html/libtool/2008-06/msg00082.html

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Create default channel on add-context if none
David Goulet [Tue, 6 Nov 2012 19:35:43 +0000 (14:35 -0500)] 
Fix: Create default channel on add-context if none

For both kernel and UST, if no channel exists and an add-context command
is sent, the default channel0 is created and the context(es) are set.

Fixes #391

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoSupport new liblttng-ust-ctl error code
Mathieu Desnoyers [Tue, 6 Nov 2012 18:47:17 +0000 (13:47 -0500)] 
Support new liblttng-ust-ctl error code

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Add EPIPE error handling on buffer splice
David Goulet [Tue, 6 Nov 2012 14:41:35 +0000 (09:41 -0500)] 
Fix: Add EPIPE error handling on buffer splice

Even though this is _not_ documented in splice(2), if the fd_out is a
socket but closed on one end, splice returns a negative value and set
errno to EPIPE. The man page specifies a EBADF but I guess both are
possible (and it is according to the kernel 3.6.2 source).

So, when streaming a kernel session (using splice), if the relayd quits,
a splice on the socket returns an EPIPE.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Channel creation error return code was not set
David Goulet [Mon, 5 Nov 2012 22:03:19 +0000 (17:03 -0500)] 
Fix: Channel creation error return code was not set

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Wrong poll events on UST application socket
David Goulet [Mon, 5 Nov 2012 21:49:40 +0000 (16:49 -0500)] 
Fix: Wrong poll events on UST application socket

The thread manage apps was adding UST sockets to the poll set with the
POLLIN event registered. However, the thread was not handling this event
which could ultimately cause an infinite loop if the application sends
data.

This has been observed with the bug386 when an application is stopped
and a lttng command is sent.

https://bugs.lttng.org/issues/386

Furthermore, a time window between the send and the reply recv of an UST
command was making the app manager loop actively because of a POLLIN
event on the socket caused by the reply from the application which is
finally handled a bit after by the client thread. This was not that
problematic but lead to a lot of repeated debug message and CPU time
lost.

This application thread is *only* handling error event usually triggered
by a close() on the UST socket thus OK to *not* wait for POLLIN/POLLOUT
event.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Remove dependency to urcu-cds in tools tests
Christian Babeux [Fri, 2 Nov 2012 19:04:02 +0000 (15:04 -0400)] 
Fix: Remove dependency to urcu-cds in tools tests

The -lurcu-cds link flag is not mandatory to link any of the tests.
Also, adding this flag can cause multiple symbol definition errors when
linking statically because the libhashtable contains symbol names that
are also present in urcu-cds.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Missing librt dependency in configure check for lttng-ust-ctl
Christian Babeux [Fri, 2 Nov 2012 19:03:17 +0000 (15:03 -0400)] 
Fix: Missing librt dependency in configure check for lttng-ust-ctl

The lttng-ust-ctl library depends on librt. The AC_CHECK_LIBRARY macro
can't automatically resolve dependents libraries (ala libtool), so any
additionnals dependencies must be manually specified.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Don't append datetime to default session name
David Goulet [Fri, 2 Nov 2012 18:14:26 +0000 (14:14 -0400)] 
Fix: Don't append datetime to default session name

The liblttng-ctl was appending the date and time to the "auto" session
if detected. The 'auto' keyword is only used by lttng command line

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Deny session creation name 'auto'
David Goulet [Fri, 2 Nov 2012 17:45:05 +0000 (13:45 -0400)] 
Fix: Deny session creation name 'auto'

This is a reserved keyword for default session(s). Note that this is
only for the lttng command line tool. Using 'auto' is possible with the
API but the current date and time is automatically appended to it for
now so be aware of that.

Fixes #359

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Add space for stream name CPU number
David Goulet [Fri, 2 Nov 2012 17:16:29 +0000 (13:16 -0400)] 
Fix: Add space for stream name CPU number

Fixes #358

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Add output option to enable-channel command
David Goulet [Fri, 2 Nov 2012 16:38:33 +0000 (12:38 -0400)] 
Fix: Add output option to enable-channel command

Allow to specify an output mode for the channel (MMAP or SPLICE).

A new error code is introduced to notify the user that the operation is
not supported. Useful for user space tracing which does NOT support
splice mode.

Fixes #335

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoUpdate version to v2.1.0-rc6 v2.1.0-rc6
David Goulet [Fri, 2 Nov 2012 15:31:28 +0000 (11:31 -0400)] 
Update version to v2.1.0-rc6

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Add filtering tests for uncovered cases
Christian Babeux [Wed, 31 Oct 2012 13:00:45 +0000 (09:00 -0400)] 
Tests: Add filtering tests for uncovered cases

While investigating the code coverage of the filtering feature, a couple
of possible tests cases were uncovered:

Error tests:
* Strings can't be IR root node
* Unary ! not allowed on string type
* Comparison with string type not allowed
* Logical operator not allowed with string types
* Nesting of binary operator not allowed

Valid tests:
* Cover all left/right operands permutations with
  fields ref. and numeric values.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Sync issue when deleting a data stream
David Goulet [Thu, 1 Nov 2012 20:27:08 +0000 (16:27 -0400)] 
Fix: Sync issue when deleting a data stream

A data stream was rescheduled for deletion after a flush on hang up.
Once in a normal read code path, on error, the stream is deleted and
then processed for ERR|HUP error which could also delete again the
stream causing an assert() and a failed trace.

We fix that by setting the local array to NULL for that stream once
deleted and ignoring the stream is subsequent loop if NULL.

Fixes #390

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoRename data_available to data_pending
David Goulet [Thu, 1 Nov 2012 17:02:58 +0000 (13:02 -0400)] 
Rename data_available to data_pending

This is just a rename and a change of semantic.

The lttng_data_pending returns 0 if _NO_ data is pending meaning that
the buffers are ready to be read safely. A value of 1 means that data is
still pending so the buffers are not ready for any read.

This is the same semantic as lttng_data_available but in reverse order.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: consumer health state
David Goulet [Wed, 31 Oct 2012 16:39:19 +0000 (12:39 -0400)] 
Fix: consumer health state

Fixes #389

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Add the ACCOUNTING flag to ht creation and set bucket size to 0
David Goulet [Tue, 30 Oct 2012 19:17:06 +0000 (15:17 -0400)] 
Fix: Add the ACCOUNTING flag to ht creation and set bucket size to 0

The resize feature does not work well without the accounting :)

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Bad return error code handling
David Goulet [Tue, 30 Oct 2012 19:11:18 +0000 (15:11 -0400)] 
Fix: Bad return error code handling

Two things here. First, if the tracer dies before we have time to create
the session on it, the returned value (-1) was not handled creating a
segfault on the following loop.

Second, we no longer assert on the application PID hash table delete
return value since we use add_replace on app. registration creating a
possible key reuse for a different node.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Use after free() of the rundir string
David Goulet [Tue, 30 Oct 2012 14:39:41 +0000 (10:39 -0400)] 
Fix: Use after free() of the rundir string

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Cleanup UST app session on ustctl create session error
David Goulet [Mon, 29 Oct 2012 18:49:50 +0000 (14:49 -0400)] 
Fix: Cleanup UST app session on ustctl create session error

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: add missing pthread_join in sessiond
David Goulet [Mon, 29 Oct 2012 16:02:14 +0000 (12:02 -0400)] 
Fix: add missing pthread_join in sessiond

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: free running directory string
David Goulet [Fri, 26 Oct 2012 17:30:08 +0000 (13:30 -0400)] 
Fix: free running directory string

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: UST app clean list node usage
David Goulet [Fri, 26 Oct 2012 17:23:25 +0000 (13:23 -0400)] 
Fix: UST app clean list node usage

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoAdd liblttng-ctl destructor to cleanup memory
David Goulet [Fri, 26 Oct 2012 17:12:47 +0000 (13:12 -0400)] 
Add liblttng-ctl destructor to cleanup memory

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Cleanup URIs on teardown
David Goulet [Fri, 26 Oct 2012 17:09:29 +0000 (13:09 -0400)] 
Fix: Cleanup URIs on teardown

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: relayd memleaks
David Goulet [Fri, 26 Oct 2012 17:04:27 +0000 (13:04 -0400)] 
Fix: relayd memleaks

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Memory leaks of allocated URIs
David Goulet [Fri, 26 Oct 2012 16:32:42 +0000 (12:32 -0400)] 
Fix: Memory leaks of allocated URIs

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: consumer output memory leak on creation
David Goulet [Fri, 26 Oct 2012 16:20:41 +0000 (12:20 -0400)] 
Fix: consumer output memory leak on creation

The sockets hash table was allocated two times hence losing the first
reference at the second allocation.

Furthermore, when a kernel/ust session is created, a default consumer is
allocated but was lost short after that when the tracing session current
consumer was copied and the pointer was overwritten.

Note that this fixes the memory leak but there is a code logic that
seems wrong when it comes to handle the consumer object trace path and
subdir during the session creation. A comment has been added and it
should be fixed.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: missing addrlen initialization before accept(2)
David Goulet [Fri, 26 Oct 2012 15:48:19 +0000 (11:48 -0400)] 
Fix: missing addrlen initialization before accept(2)

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: relayd trace file padding memleak
David Goulet [Fri, 26 Oct 2012 15:23:15 +0000 (11:23 -0400)] 
Fix: relayd trace file padding memleak

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Remove useless consumer subdir string concatenation
David Goulet [Fri, 26 Oct 2012 15:18:12 +0000 (11:18 -0400)] 
Fix: Remove useless consumer subdir string concatenation

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: lttng create allocated path memleak
David Goulet [Fri, 26 Oct 2012 14:33:16 +0000 (10:33 -0400)] 
Fix: lttng create allocated path memleak

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Cppcheck memleakOnRealloc mistake
David Goulet [Fri, 26 Oct 2012 14:28:21 +0000 (10:28 -0400)] 
Fix: Cppcheck memleakOnRealloc mistake

Common realloc mistake: "data_buffer" nulled but not freed upon failure.
Common realloc mistake: "tmp" nulled but not freed upon failure

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Synchronization issue for data available command
David Goulet [Thu, 25 Oct 2012 19:48:15 +0000 (15:48 -0400)] 
Fix: Synchronization issue for data available command

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: consumer relayd cleanup on disconnect
David Goulet [Thu, 25 Oct 2012 19:34:59 +0000 (15:34 -0400)] 
Fix: consumer relayd cleanup on disconnect

Improve the resilience of the consumer by cleaning up a relayd object
and all associated streams when a write error is detected on a relayd
socket.

Fixes #385

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Handle the unary bitwise negation operator (~) in the XML printer
Christian Babeux [Tue, 23 Oct 2012 19:36:41 +0000 (15:36 -0400)] 
Fix: Handle the unary bitwise negation operator (~) in the XML printer

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Possible memory leaks when creating filter IR root node
Christian Babeux [Tue, 23 Oct 2012 19:36:17 +0000 (15:36 -0400)] 
Fix: Possible memory leaks when creating filter IR root node

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Delete stream on write error in consumer
David Goulet [Wed, 24 Oct 2012 16:40:59 +0000 (12:40 -0400)] 
Fix: Delete stream on write error in consumer

Whenever a write() error occured, both on network or local trace file,
the consumer thread just died considering the error a fatal one.

This commit fixes that by simply deleting the stream, removing it from
the poll set of the thread and freeing it.

Furthermore, on a write() error, a SIGPIPE is usually raised if the FD
is invalid. The consumer is catching this signal but was initiating a
should exit action thus ultimately cleaning all threads. We now still
catch SIGPIPE but don't set the should quit flag so normal cleanup can
be done by the threads.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Error handling when sending relayd sockets to consumer
David Goulet [Mon, 22 Oct 2012 21:24:40 +0000 (17:24 -0400)] 
Fix: Error handling when sending relayd sockets to consumer

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoAdd stream lock comment for nesting
David Goulet [Mon, 22 Oct 2012 21:18:44 +0000 (17:18 -0400)] 
Add stream lock comment for nesting

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Mutex and RCU lock nesting in consumer
David Goulet [Mon, 22 Oct 2012 21:16:38 +0000 (17:16 -0400)] 
Fix: Mutex and RCU lock nesting in consumer

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Uninitialized ret code
David Goulet [Mon, 22 Oct 2012 21:15:19 +0000 (17:15 -0400)] 
Fix: Uninitialized ret code

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Remove bad condition and fix overflow issue
David Goulet [Mon, 22 Oct 2012 20:44:51 +0000 (16:44 -0400)] 
Fix: Remove bad condition and fix overflow issue

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: consumerd pthread error flow
David Goulet [Mon, 22 Oct 2012 20:38:52 +0000 (16:38 -0400)] 
Fix: consumerd pthread error flow

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Set a single return point and mutex unlock
David Goulet [Mon, 22 Oct 2012 20:37:10 +0000 (16:37 -0400)] 
Fix: Set a single return point and mutex unlock

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Remove useless NULL and zero assignment
David Goulet [Mon, 22 Oct 2012 20:34:18 +0000 (16:34 -0400)] 
Fix: Remove useless NULL and zero assignment

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: segfault on create session with two URLs
David Goulet [Mon, 22 Oct 2012 19:32:34 +0000 (15:32 -0400)] 
Fix: segfault on create session with two URLs

https://bugs.lttng.org/issues/350

Fixes #350

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoUpdate version to v2.1.0-rc5 v2.1.0-rc5
David Goulet [Mon, 22 Oct 2012 16:32:22 +0000 (12:32 -0400)] 
Update version to v2.1.0-rc5

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Add missing header to makefile
David Goulet [Mon, 22 Oct 2012 16:25:45 +0000 (12:25 -0400)] 
Fix: Add missing header to makefile

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Remove network stream ID ABI calls
Julien Desfossez [Wed, 17 Oct 2012 00:44:13 +0000 (20:44 -0400)] 
Fix: Remove network stream ID ABI calls

This patch removes some experimental kernel ABI calls that were not
supposed to get merged. The kernel support for these calls has never
been introduced in lttng-modules.

I'm not sure how it happened, but it seems that this code got introduced
along with the commit 00e2e675d54dc726a7c8f8887c889cc8ef022003

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Add filtering tests to configure
Christian Babeux [Tue, 16 Oct 2012 18:33:23 +0000 (14:33 -0400)] 
Tests: Add filtering tests to configure

Add filtering folder to top-level Makefile.am. Also add a runall script
to run all filtering tests.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Add a test for valid filters
Christian Babeux [Tue, 16 Oct 2012 18:33:22 +0000 (14:33 -0400)] 
Tests: Add a test for valid filters

This test validate that for a given filter the expected trace output is
conform to the expected filter behavior.

This test rely on the babelstats utility. With the help of this script,
we can verify that the expected minimum and maximum values on fields of
interest are within the expected ranges.

For example, given 100 iterations on a tracepoint with the field
'intfield', with values starting from 0 and incrementing on each
iteration, and the filter expression 'intfield < 4', we would expect
that the min-max range lie within [0,3].

Thus, if the babelstat computed range does not match the expected range,
this could potentially indicate failure in the filtering mechanism.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Add a trace statistics utility
Christian Babeux [Tue, 16 Oct 2012 18:33:21 +0000 (14:33 -0400)] 
Tests: Add a trace statistics utility

The babelstats script output statistics on fields values for
a particular tracepoint. At the moment, the script only show
minimum and maximum value for each fields of a particular
tracepoint.

The trace must be in the babeltrace text format. It can be
passed via stdin.

The script output this format:
field_name min max

Sample usage:

> babeltrace sometracedir | babelstats.pl --tracepoint tp:tptest

_seqfield1_length 4 4
seqfield2 "test" "test"
stringfield2 "\*" "\*"
floatfield 2222 2222
netintfieldhex 0x0 0x63
_seqfield2_length 4 4
longfield 0 99
netintfield 0 99
intfield2 0x0 0x63
intfield 0 99
stringfield "test" "test"
doublefield 2 2
arrfield2 "test" "test"

Use case:
This script could be useful to validate that fields values
are within some predefined expected ranges.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Add a test for invalid filters
Christian Babeux [Tue, 16 Oct 2012 18:33:20 +0000 (14:33 -0400)] 
Tests: Add a test for invalid filters

This test validate that an invalid filter (unmatched parenthesis,
field dereferences, unsupported ops, etc.) are correctly flagged
as such.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Add an unsupported operators filtering test
Christian Babeux [Tue, 16 Oct 2012 18:33:19 +0000 (14:33 -0400)] 
Tests: Add an unsupported operators filtering test

This test validate that filters with unsupported operators are
correctly flagged and that an enable event with these filters
properly fails.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoWait for data availability when stopping a session
David Goulet [Wed, 17 Oct 2012 17:40:49 +0000 (13:40 -0400)] 
Wait for data availability when stopping a session

The lttng_stop_tracing now waits by default for data availability. A
status output is added in the library on stdout.

A no wait version is added to the API and the option no-wait is added to
the lttng command line for the stop command.

Also good to note that if a second stop_tracing call is done on an
already stopped session, the call will wait for data availability before
returning if the stop command on the session daemon returned an already
stopped error code.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoRelayd data available command support
David Goulet [Fri, 19 Oct 2012 16:48:45 +0000 (12:48 -0400)] 
Relayd data available command support

Add the data available support on the relayd side and use it if the
tracing session is streaming on the network.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoLib lttng-ctl data available command support
David Goulet [Wed, 17 Oct 2012 16:05:42 +0000 (12:05 -0400)] 
Lib lttng-ctl data available command support

New API call lttng_data_available that returns 0 if the data is NOT
available for reading or else 1 if it it.

The session daemon supports the call and uses the consumer data
available feature.

Note that there is still no support for this command on the relayd side
at this commit.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoConsumer daemon data available command support
David Goulet [Tue, 16 Oct 2012 20:42:40 +0000 (16:42 -0400)] 
Consumer daemon data available command support

Only the UST and kernel consumer daemon supports the data available
command thus it's not yet implemented on the session daemon.

Once implemented in the liblttng-ctl and session daemon, the commit will
explain the purpose of this command.

This is mostly to separate commits so we don't push a 2000 liners
upstream.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoSupport the add operation of urcu hash table
David Goulet [Tue, 16 Oct 2012 19:06:12 +0000 (15:06 -0400)] 
Support the add operation of urcu hash table

This add operation supports redundant keys in the table.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoAdd data structure for the data available command
David Goulet [Tue, 16 Oct 2012 18:08:08 +0000 (14:08 -0400)] 
Add data structure for the data available command

The new stream hash table indexed by session id is added. The per
consumer stream mutex used for the synchronization between threads
accessing the stream which will be indexed in two hash tables.

Also, the data available command is added to both UST and kernel
consumer but for now returns ENOSYS. Just set the skeleton for the
implementation.

Finally, the session id is added to the trace-kernel (where it already
exists for UST) so it could be used later on for the data available
command.

This session id is also added in the consumer data structure for the
same purpose.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoRemove unused code
David Goulet [Tue, 16 Oct 2012 15:42:23 +0000 (11:42 -0400)] 
Remove unused code

The consumer change stream state function has been removed since it was
not only not used but using the stream_ht also removed with this patch.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoCleanup code and rename variables
David Goulet [Tue, 16 Oct 2012 15:03:16 +0000 (11:03 -0400)] 
Cleanup code and rename variables

No behavior altered. Only code cleanup and renaming of the consumer poll
pipe to "consumer_data_pipe".

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoChange the metadata hash table node
David Goulet [Thu, 11 Oct 2012 21:05:42 +0000 (17:05 -0400)] 
Change the metadata hash table node

Remove the use of the "waitfd_node" for metadata and index the "node" by
wait fd during stream allocation only for metadata stream.

This is done so the waitfd node could be used later on for the hash
table indexing stream by session id for the traced data check command
(soon to be implemented).

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoMake stream hash tables global to the consumer
David Goulet [Thu, 11 Oct 2012 20:48:57 +0000 (16:48 -0400)] 
Make stream hash tables global to the consumer

The data stream hash table is now global to the consumer and used in the
data thread. The consumer_data stream_ht is no longer used to track the
data streams but instead will be used (and possibly renamed) by the
session daemon poll thread to keep track of streams on a per session id
basis for the upcoming feature that check traced data availability.

For now, in order to avoid mind bugging problems to access the streams,
both hash table are now defined globally (metadata and data). However,
stream update are still done in a single thread. Don't count on this to
be guaranteed in the next commits.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoMove add data stream to the data thread
David Goulet [Thu, 11 Oct 2012 19:22:59 +0000 (15:22 -0400)] 
Move add data stream to the data thread

As a second step of refactoring, upon receiving a data stream, we send
it to the data thread that is now in charge of handling it.

The ustctl_* calls are moved into the on_recv_stream function call
executed once the stream is allocated and fds have been received. This
also fits with the kernel consumer which mmap the buffers in the
on_recv_stream call.

This commit should speed up the add stream process for the session
daemon. There is still some actions to move out of the session daemon
poll thread to significantly gain speed, especially for network
streaming.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoRename consumer threads and spawn them in daemon
David Goulet [Thu, 11 Oct 2012 17:10:29 +0000 (13:10 -0400)] 
Rename consumer threads and spawn them in daemon

The metadata thread is now created in the lttng-consumerd daemon so all
thread could be controlled inside the daemon.

This is the first step of a consumer thread refactoring which aims at
moving data and metadata stream operations inside a dedicated thread so
the session daemon thread does not block and is more efficient at adding
streams.

The most important concept is that a stream file descriptor MUST be
opened as quickly as we can then passed to the right thread (for UST
since they are already opened by the session daemon for the kernel).

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: relayd close stream command was not working
David Goulet [Fri, 19 Oct 2012 16:44:09 +0000 (12:44 -0400)] 
Fix: relayd close stream command was not working

Somehow, the stream last_net_seq_num was not updated on the relayd side
causing the close stream check to fail each single time.

However, the stream is also closed on a session destroy, if any, so
there is no leaks once the FD hung up and no broken feature.

Acked-by: Julien Desfossez <julien.desfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix last commit. Git code-18 pushed the wrong fix.
David Goulet [Fri, 19 Oct 2012 16:39:59 +0000 (12:39 -0400)] 
Fix last commit. Git code-18 pushed the wrong fix.

Fixes #374 #382

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Relayd and consumerd socket leaks
David Goulet [Fri, 19 Oct 2012 16:07:36 +0000 (12:07 -0400)] 
Fix: Relayd and consumerd socket leaks

Using the set_consumer_uri call, the connection is established between
the session daemon and the relayd then sent to the relayd. However, when
start_tracing is initiated, the sessiond creates, if needed, the relayd
sockets and send them to the consumer. A validation was missing in one
of the function call to validate if the sockets were already sent to the
consumer.

Note that using lttng_create_session with a remote URL, the sockets are
created only when tracing starts thus not having this issue.

This fixes leaks on the relayd and consumerd when destroying a session.

Fixes #374 #382

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Missing -ENODATA handling in the consumer
David Goulet [Tue, 16 Oct 2012 18:50:46 +0000 (14:50 -0400)] 
Fix: Missing -ENODATA handling in the consumer

Fixes #379

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Empty metadata buffer(s) on HUP|ERR
David Goulet [Tue, 16 Oct 2012 18:21:29 +0000 (14:21 -0400)] 
Fix: Empty metadata buffer(s) on HUP|ERR

The metadata fd was not emptying all the buffers on POLLHUP | POLLERR.
This patch makes the read subbuffer operation, for hung up metadata fd,
loop until the returned len is a negative value. For user space tracing,
-EAGAIN is returned and -ENODATA for the kernel tracer.

We also fixes another issue where an error returned (not -EAGAIN) by the
read subbuffer function call was stopping the thread. Now, the fd is
removed from the poll set, the stream is freed and the thread continues.

Fixes #378

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoABI with support for compat 32/64 bits
Julien Desfossez [Tue, 2 Oct 2012 19:03:26 +0000 (15:03 -0400)] 
ABI with support for compat 32/64 bits

The current ABI does not work for compat 32/64 bits. This patch moves
the current ABI as old-abi and provides a new ABI in which all the
structures exchanged between user and kernel-space are packed. Also this
new ABI moves the "int overwrite" member of the struct
lttng_kernel_channel to remove the alignment added by the compiler.

A patch for lttng-modules has been developed in parallel to this one to
support the new ABI. These 2 patches have been tested in all possible
configurations (applied or not) on 64-bit and 32-bit kernels (with
CONFIG_COMPAT) and a user-space in 32 and 64-bit.

Here are the results of the tests :
k 64 compat     | u 32 compat     | OK
k 64 compat     | u 64 compat     | OK
k 64 compat     | u 32 non-compat | KO
k 64 compat     | u 64 non-compat | OK

k 64 non-compat | u 64 compat     | OK
k 64 non-compat | u 32 compat     | KO
k 64 non-compat | u 64 non-compat | OK
k 64 non-compat | u 32 non-compat | KO

k 32 compat     | u compat        | OK
k 32 compat     | u non-compat    | OK

k 32 non-compat | u compat        | OK
k 32 non-compat | u non-compat    | OK

The results are as expected :
- on 32-bit user-space and kernel, every configuration works.
- on 64-bit user-space and kernel, every configuration works.
- with 32-bit user-space on a 64-bit kernel the only configuration
  where it works is when the compat patch is applied everywhere.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Stream allocation and insertion consistency
David Goulet [Wed, 3 Oct 2012 15:22:50 +0000 (11:22 -0400)] 
Fix: Stream allocation and insertion consistency

This commit restores the consistency between the allocate and insertion
operations on streams. The allocate stream function was changing the
channel state by updating the refcount, cpucount and number of init
stream. We now moved these operations into the add_stream function so
that the initialization is done there and the del_stream handles the
cleanup.

So basically, any side effect done on a channel using a stream is now
done in the add/del functions. The same was done for the metadata which
is a special case that does not need to set the need update flag.

Furthermore, the consumer_del_stream now can destroy a stream even if
that stream was not successfully added to its hash table. The kernel and
UST consumers now use it on error between allocation and the add_stream
function.

This refactoring fixes memory leaks, bad refcount values and file
descriptor leaks. Also, the metadata destroy stream function was also
fixed to use the waitfd_node which is also fixed in the
consumer_del_metadata_stream that was deleting the wrong node pointer.

The waitfd_node fixes were merged with this commit in order to make the
whole patch works and not failed on make check.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: output number of bytes written by relayd
Julien Desfossez [Wed, 3 Oct 2012 23:40:28 +0000 (19:40 -0400)] 
Fix: output number of bytes written by relayd

The print of the number of bytes written in the tracefile by the relayd
was after the call to write the padding, so the debug output was
confusing:

DEBUG3: Receiving data of size 2097133 for stream id 567 seqnum 0 [in
relay_process_data() at main.c:1394]
DEBUG2: Relay wrote 19 bytes to tracefile for stream id 567 [in
relay_process_data() at main.c:1416

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoAdd hash table argument to helper functions
David Goulet [Wed, 3 Oct 2012 15:19:45 +0000 (11:19 -0400)] 
Add hash table argument to helper functions

This allows these helper functions to be used more broadly across the
code base and not for a specific hash table.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Add missing call rcu and read side lock
David Goulet [Wed, 3 Oct 2012 15:14:50 +0000 (11:14 -0400)] 
Fix: Add missing call rcu and read side lock

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Fix LD_PRELOAD library lookup path for health tests
Christian Babeux [Wed, 3 Oct 2012 16:36:57 +0000 (12:36 -0400)] 
Tests: Fix LD_PRELOAD library lookup path for health tests

The LD_PRELOAD library lookup was failing when the tests were not runned
in the health directory.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Add arbitrary wait period for kernel streaming test
David Goulet [Wed, 3 Oct 2012 16:29:24 +0000 (12:29 -0400)] 
Fix: Add arbitrary wait period for kernel streaming test

Once the trace has been destroy, there is a race condition between
reading the trace and the trace being completely written on disk.

We don't have anyway of telling if the streamed trace has been completed
so we have to add an arbitrary wait period so the test can successfully
parse and validate the trace.

I never hit that problem until this morning with my Linux 3.6.0 kernel.
Maybe related or not, still the trace can occur on slower systems.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix coding style and add/change debug statements
David Goulet [Wed, 3 Oct 2012 15:07:14 +0000 (11:07 -0400)] 
Fix coding style and add/change debug statements

Change all perror() to PERROR() and add some DBG() and ERR() statement
for easier verbose reading.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Build out of src tree
Paul Chavent [Tue, 2 Oct 2012 20:42:16 +0000 (16:42 -0400)] 
Fix: Build out of src tree

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Add health check tests to configure
Christian Babeux [Tue, 2 Oct 2012 18:20:04 +0000 (14:20 -0400)] 
Tests: Add health check tests to configure

Add health folder to top-level tests Makefile.am. Also add a runall
script to run all health check tests.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
This page took 0.043915 seconds and 4 git commands to generate.