lttng-tools.git
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 years agoTests: Add health check thread stall test
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>
12 years agoTests: Add health check thread exit test
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>
12 years agoTests: Add a health check utility program
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>
12 years agoAdd testpoints in lttng-sessiond for each threads
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>
12 years agoNew testpoint mechanism to instrument binaries for testing
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>
12 years agoFix: off-by-one in comm proto between lttng-ctl and sessiond
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>
12 years agoFix: Metadata stream leak when received in consumer
David Goulet [Fri, 28 Sep 2012 19:43:19 +0000 (15:43 -0400)] 
Fix: Metadata stream leak when received in consumer

Between threads, when the metadata stream is received, it is allocated.
We now pass the pointer to the metadata thread thus fixing a memory leak
because the original stream was never freed.

This commit also modified some debug statements and remove a duplicate
code snippet.

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: consumer_allocate_stream error handling
Mathieu Desnoyers [Fri, 28 Sep 2012 20:41:25 +0000 (16:41 -0400)] 
Fix: consumer_allocate_stream error handling

Fix a memory leak and "be nice" when handling stream alloc errors. Upon
CPU hotplug, it is possible that we receive a stream only after all
other streams are finalized, which means it could happen that we discard
that channel, in the unlikely event that we have cpu hotplug
concurrently with destroy.

Moreover, this fix the return path of channel lookup failure: we were
returning an zeroed stream rather than returning an error, which was
certainly not the intended behavior.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: consumer should await for initial streams
Mathieu Desnoyers [Fri, 28 Sep 2012 19:39:42 +0000 (15:39 -0400)] 
Fix: consumer should await for initial streams

lttng-sessiond need to let the consumer know how many streams are sent
initially, so that for very short traces (short-lived apps, short kernel
trace), the consumerd don't run into the scenario where it deletes the
channel when there are still pending streams to receive for this
channel.

Fixes #355

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: Missing rcu read side lock in consumer
David Goulet [Fri, 28 Sep 2012 16:08:15 +0000 (12:08 -0400)] 
Fix: Missing rcu read side lock in consumer

The metadata thread was not using rcu read side lock for its operations
on the internal metadata hash table.

This led to faulty free() when destroying the hash table and possible
corrupted data when it was resized.

Also change some static definition of calls inside consumer.c.

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoUpdate version to v2.1.0-rc4 v2.1.0-rc4
David Goulet [Wed, 26 Sep 2012 16:00:02 +0000 (12:00 -0400)] 
Update version to v2.1.0-rc4

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: Change sempahore to pthread conditions
David Goulet [Wed, 19 Sep 2012 14:15:45 +0000 (10:15 -0400)] 
Fix: Change sempahore to pthread conditions

Fixes #324

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: relayd relay_send_version: handle sscanf return code
Mathieu Desnoyers [Wed, 26 Sep 2012 02:16:44 +0000 (22:16 -0400)] 
Fix: relayd relay_send_version: handle sscanf return code

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix relayd: NULL ptr deref
Mathieu Desnoyers [Wed, 26 Sep 2012 02:10:06 +0000 (22:10 -0400)] 
Fix relayd: NULL ptr deref

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: relayd: possible NULL ptr deref, memory leak, accept fd leak
Mathieu Desnoyers [Wed, 26 Sep 2012 02:03:47 +0000 (22:03 -0400)] 
Fix: relayd: possible NULL ptr deref, memory leak, accept fd leak

- relay_cmd was not freed on error.
- newsock is a pointer. A pointer is always > 0. (unsigned comparison)
- if / else if  could lead to newsock to be dereferenced while NULL.
- missing lttcomm_destroy_sock on newsock on setsockopt error.
  Memory and FD leak.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoTests: add print bytecode to filter grammar test
Mathieu Desnoyers [Wed, 26 Sep 2012 00:49:41 +0000 (20:49 -0400)] 
Tests: add print bytecode to filter grammar test

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 years agoCleanup: assign values to bytecode opcodes
Mathieu Desnoyers [Wed, 26 Sep 2012 00:47:36 +0000 (20:47 -0400)] 
Cleanup: assign values to bytecode opcodes

This is part of a fixed ABI anyway, and it helps debugging.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 years agoFix: Filter: Fix allocation length error
Mathieu Desnoyers [Wed, 26 Sep 2012 00:46:10 +0000 (20:46 -0400)] 
Fix: Filter: Fix allocation length error

Was causing generation of corrupted filter bytecode.

Fixes #351,#344

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 years agoFix: Filter: add missing ast free
Mathieu Desnoyers [Wed, 26 Sep 2012 00:44:24 +0000 (20:44 -0400)] 
Fix: Filter: add missing ast free

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 years agoAdd testpoint mechanism proposal 0005
David Goulet [Tue, 25 Sep 2012 19:27:49 +0000 (15:27 -0400)] 
Add testpoint mechanism proposal 0005

A patch is coming later on that implements this proposal. Authored by
Christian Babeux <christian.babeux@efficios.com>.

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoTests: Add high throughput with bandwidth limits test
Christian Babeux [Tue, 25 Sep 2012 16:06:38 +0000 (12:06 -0400)] 
Tests: Add high throughput with bandwidth limits test

This test is used to stress the new streaming feature with high
throughput in a bandwidth limited use case.

The bandwidth limitation is done via the tc (traffic control) kernel
utility. Root permissions are needed to set bandwidth limits.  Limits
are set on the loopback interface (lo).

The test cycle through bandwidth limits from 3200kbits to 50kbits.
There are currently two known limitations/issues:

- The tests fails when the lttng stop commands is issued right after the
  traced applications are done executing.

- Setting a bandwidth limit on the control port of the relayd will
  trigger a timeout in the sessiond.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: Returned code when listing kernel channel
David Goulet [Mon, 24 Sep 2012 20:55:08 +0000 (16:55 -0400)] 
Fix: Returned code when listing kernel channel

The lttng_list_channels() API call now returns a
LTTNG_ERR_KERN_CHAN_NOT_FOUND or LTTNG_ERR_UST_CHAN_NOT_FOUND when there
is no channel enabled for the session and domain.

Changes had to be made to the list command in order to correctly manage
the returned code.

The bug260 mentionned that the session(s) were destroyed but this could
not be reproduce. However, the rest of the bug description is valid.

Fixes #260

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoTests: Rename helper functions to have consistent names
Christian Babeux [Mon, 24 Sep 2012 16:11:47 +0000 (12:11 -0400)] 
Tests: Rename helper functions to have consistent names

Most of the helper functions had inconsistent naming.

Suggested naming convention for helper functions:

<action>_<bin_name>
or
<action>_lttng_<command>

List of modified helper functions:

lttng_start_relayd -> start_lttng_relayd
lttng_stop_relayd  -> stop_lttng_relayd

start_sessiond     -> start_lttng_sessiond
stop_sessiond      -> stop_lttng_sessiond

start_tracing      -> start_lttng_tracing
stop_tracing       -> stop_lttng_tracing

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoTests: Cleanup redundant code and use printing helper functions
Christian Babeux [Mon, 24 Sep 2012 16:11:46 +0000 (12:11 -0400)] 
Tests: Cleanup redundant code and use printing helper functions

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoTests: Add helper functions for printing status and banner
Christian Babeux [Mon, 24 Sep 2012 16:11:45 +0000 (12:11 -0400)] 
Tests: Add helper functions for printing status and banner

Add three new printing functions:

print_ok: Print the OK status with optional color support.
print_fail: Print the FAIL status with optional color support.
print_test_banner: Print a test banner of the test description.

e.g.:
sometest.sh:
TEST_DESC="A really useful test"
[...]
source $TESTDIR/utils.sh
print_test_banner $TEST_DESC
[...]
print_ok
print_fail
[...]

$ ./sometest.sh
----------------------
A really useful test
----------------------
OK
FAIL

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoTests: Add a check for color support when printing status
Christian Babeux [Mon, 24 Sep 2012 16:11:44 +0000 (12:11 -0400)] 
Tests: Add a check for color support when printing status

When printing the status of test is OK or FAIL, check if stdout is
attached to a terminal device. This way the output is not cluttered with
useless escape characters. Some use cases where we don't want colors:

$ ./sometest | less

$ ./sometest > a.log

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: Lib lttng-ctl on error returns lttng code
David Goulet [Mon, 24 Sep 2012 19:35:18 +0000 (15:35 -0400)] 
Fix: Lib lttng-ctl on error returns lttng code

The library was returning negative value that were NOT a lttng error
code documented in lttng-error.h. This was problematic because the
lttng_strerror() could not recognized the returned code and thus the
caller was clueless about the error.

This patch makes sure every lttng-ctl calls return either the correct
documented positive value or a negative lttng error code on error that
can be directly translate by lttng_strerror() which takes a negative
lttng code.

Small fix: enable event command, when hitting a loglevel error now
returns a lttng error code and does not print the help anymore.

Fixes #337

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: lttng_set_event_filter() was returning bad error code
David Goulet [Mon, 24 Sep 2012 17:24:48 +0000 (13:24 -0400)] 
Fix: lttng_set_event_filter() was returning bad error code

Change the API call to return a lttng-error.h code. Also change the
already enable filter message from an ERR() to a WARN().

On error, the lttng UI now prints the returned error from the API call.

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: printing [no write] on lttng list -uf
David Goulet [Mon, 24 Sep 2012 17:14:01 +0000 (13:14 -0400)] 
Fix: printing [no write] on lttng list -uf

The print message was using the wrong condition to print [no write].

Fixes #345

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: Disable event on filter error with lttng
David Goulet [Mon, 24 Sep 2012 16:48:29 +0000 (12:48 -0400)] 
Fix: Disable event on filter error with lttng

This patch slightly improves filter output messages and add a MSG() when
the filter is successfully set.

When a filter error occured, the enable _all_ events success message was
not printed out. This commit fixes this issue.

Fixes #343

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoAdd test file from stable-2.0 to gitignore
David Goulet [Mon, 24 Sep 2012 14:50:38 +0000 (10:50 -0400)] 
Add test file from stable-2.0 to gitignore

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: Wrong returned error code on UST enable event
David Goulet [Fri, 21 Sep 2012 16:59:10 +0000 (12:59 -0400)] 
Fix: Wrong returned error code on UST enable event

Instead of sending back a FATAL error, correctly notify the user of a
failed UST enable event.

The bug261 was not reproducible anymore but led to this fix.

(Closes 261)

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoAdd consumer commands to lttng.1 man page
David Goulet [Wed, 19 Sep 2012 16:25:52 +0000 (12:25 -0400)] 
Add consumer commands to lttng.1 man page

enable-consumer and disable-consumer are documented in lttng.1

The create command was also modified in version 2.1.

Some basic fixes of indentation, syntax and updates.

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoAdd lttng_health_check(3) man page
David Goulet [Tue, 18 Sep 2012 16:24:51 +0000 (12:24 -0400)] 
Add lttng_health_check(3) man page

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: Remove LPOLLNVAL from consumer metadata revents
David Goulet [Tue, 18 Sep 2012 15:13:33 +0000 (11:13 -0400)] 
Fix: Remove LPOLLNVAL from consumer metadata revents

Without epoll(7), this value does not exist in the compat layer. For
now, this poll error is set within the LPOLLHUP in the poll(2) compat
header and POLLNVAL of epoll is set to POLLHUP so we basically don't
need it at all if we simply use the LPOLLHUP code.

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: Mismatch of field name between ust and tools
Christian Babeux [Mon, 17 Sep 2012 21:32:03 +0000 (17:32 -0400)] 
Fix: Mismatch of field name between ust and tools

The "written" field of the lttng_event_field and lttng_ust_field_iter
structures has been renamed to "nowrite" in the upstream version of
lttng-ust.

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