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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
David Goulet [Fri, 26 Oct 2012 17:04:27 +0000 (13:04 -0400)]
Fix: relayd memleaks
Signed-off-by: David Goulet <dgoulet@efficios.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Christian Babeux [Tue, 2 Oct 2012 18:06:30 +0000 (14:06 -0400)]
Tests: Add health check thread stall test
This test trigger a "code stall" in a specified thread using the
testpoint mechanism. The testpoint behavior is implemented in
health_stall.c. The testpoint code stall a specific thread processing by
calling sleep(3).
The test select the thread to be stalled by enabling a specific
environment variable.
The test ensure the threads can be succesfully stalled and that the
health check feature is able to properly detect stalling in non-polling
cases.
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Christian Babeux [Tue, 2 Oct 2012 18:05:32 +0000 (14:05 -0400)]
Tests: Add health check thread exit test
This test trigger a failure in a specified thread using the recently
introduced testpoint mechanism. The testpoints behavior is implemented
in health_exit.c. The testpoint code simply calls pthread_exit(3) and
effectively "kill" the thread without affecting the other threads
behavior.
The test select the thread to be "killed" by enabling a specific
environment variable.
With this test we ensure that each thread can be succesfully terminated
and that the health check feature properly detect a failure.
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Christian Babeux [Tue, 2 Oct 2012 18:19:19 +0000 (14:19 -0400)]
Tests: Add a health check utility program
The health_check program is a simple utility to query the health
status of the different threads of the sessiond.
Sample output:
> ./health_check
Health check cmd: 0
Health check app. manage: 0
Health check app. registration: 0
Health check kernel: 0
Health check consumer: 0
The return code is encoded to indicate which thread has failed.
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Christian Babeux [Tue, 2 Oct 2012 20:00:27 +0000 (16:00 -0400)]
Add testpoints in lttng-sessiond for each threads
This commit adds 8 new testpoints in the lttng-sessiond binary. These
testpoints rely on the testpoints infrastructure introduced recently.
Testpoints:
thread_manage_clients
thread_manage_clients_before_loop
thread_registration_apps
thread_manage_apps
thread_manage_apps_before_loop
thread_manage_kernel
thread_manage_kernel_before_loop
thread_manage_consumer
The thread_<thread_name> testpoints are placed directly at the thread
start and they can be used to trigger failure in <thread_name>.
The thread_<thread_name>_before_loop testpoints are placed directly
before the main processing loop of the thread and thus can be used to
stall the processing of the thread.
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Christian Babeux [Fri, 14 Sep 2012 19:00:30 +0000 (15:00 -0400)]
New testpoint mechanism to instrument binaries for testing
This commit introduce two new macros: TESTPOINT_DECL(name) and
testpoint(name).
Here a quick example that show how to use the testpoint mechanism:
file: main.c
/* Testpoint declaration */
TESTPOINT_DECL(interesting_function)
void interesting_function(void)
{
testpoint(interesting_function);
/* Some processing that can fail */
...
}
int main(int argc, char *argv[])
{
interesting_function();
...
printf("End");
}
file: testpoint.c
void __testpoint_interesting_function(void)
{
printf("In testpoint of interesting function!");
}
Compile:
gcc -o test main.c
gcc -fPIC -shared -o testpoint.so testpoint.c
Run:
> ./test
End
> export LTTNG_TESTPOINT_ENABLE=1
> LD_PRELOAD=testpoint.so ./test
In testpoint of interesting function!
End
> export LTTNG_TESTPOINT_ENABLE=0
> LD_PRELOAD=testpoint.so ./test
End
The testpoint mechanism is triggered via the preloading of a shared
object containing the appropriate testpoint symbols and by setting the
LTTNG_TESTPOINT_ENABLE environment variable.
The check on this environment variable is done on the application
startup with the help of a constructor (lttng_testpoint_check) which
toggle a global state variable indicating whether or not the testpoints
should be activated.
When enabled, the testpoint() macro calls an underlying wrapper specific
to the testpoint and simply try to lookup the testpoint symbol via a
dlsym() call.
When disabled, the testpoint() call will only incur an additionnal test
per testpoint on a global variable. This performance 'hit' should be
acceptable for production use.
The testpoint mechanism should be *always on*. It can be explicitly
disabled via CFLAGS="-DNTESTPOINT" in a way similar to NDEBUG and
assert().
Please refer to 0005-testpoint-mechanism.txt for more information.
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Mathieu Desnoyers [Mon, 1 Oct 2012 23:19:29 +0000 (19:19 -0400)]
Fix: off-by-one in comm proto between lttng-ctl and sessiond
Mostly affects setting a filter on an event with large event name.
This fix breaks the ABI between lttng-ctl and lttng-sessiond, both
should be updated together, and sessiond must be restarted.
Fixes #357
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
This page took 0.044923 seconds and 4 git commands to generate.