Jesper Derehag [Thu, 27 Mar 2014 07:57:06 +0000 (08:57 +0100)]
Fix: python invocation through env
This modification calls the interpreter through env instead of
directly, which should be more portable for those distros which do not install
python into /usr/bin/.
Building LTTng-UST with --disable-shared compiles fine, but the
resulting installed static libraries silently fails to trace, because
tracepoint fails to dlopen liblttng-ust-tracepoint.so. So don't allow
this unsupported configure option.
Fix: liblttng-ust-libc-wrapper recursive use of calloc
When built with URCU with --disable-compiler-tls, URCU tls-compat.h uses
calloc in its TLS compat layer. This is used by RCU read-side, which is
used by tracepoint. So using a tracepoint in calloc triggers an infinite
recursion, since its first use of the TLS (with TLS compat) calls
calloc.
Fix this issue by keeping a per-thread nesting counter, and as soon as
we are allocating memory from a context nested within the memory
allocator, don't trace.
Don't trace from the static allocator: keep it as simple as possible,
since this is our fallback.
Lars Persson [Wed, 12 Mar 2014 09:28:49 +0000 (10:28 +0100)]
Use autoconf AM_MAINTAINER_MODE
Give distribution maintainers the option to skip rebuilding
autoconf and automake generated files. The default behaviour
is still to have the rebuild rules enabled.
Signed-off-by: Lars Persson <larper@axis.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paul Woegerer [Fri, 28 Feb 2014 09:02:00 +0000 (10:02 +0100)]
Turn base address dump into experimental feature
Instead of having base address state dump enabled by default make it
necessary to explicitly enable it with environment variable
LTTNG_UST_WITH_EXPERIMENTAL_BADDR_STATEDUMP.
Documentation is updated to reflect this change and explain about the
experimental nature of this feature.
Signed-off-by: Paul Woegerer <paul_woegerer@mentor.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
David Goulet [Thu, 27 Feb 2014 16:53:22 +0000 (11:53 -0500)]
Fix: dynamically fetch the session daemon port
When connecting to the session daemon, fetch the port at each try. This
moves the read port file functions to the TCP session daemon client
where the connect happens.
If the port file is not found, simply retry 3 seconds later. Also, this
adds a timeout to the acquire semaphore of 3 seconds.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: David Goulet <dgoulet@efficios.com>
David Goulet [Thu, 27 Feb 2014 15:06:52 +0000 (10:06 -0500)]
Fix: JUL agent connect to user and root sessiond
In order to achieve such a thing, two tracepoints are used where one is
for the regular user and the other one for root. This is to avoid
duplicating the payload in the user and root traces.
Furthermore, if a root port is found, a new thread is started to handle
the second session daemon.
Paul Woegerer [Tue, 25 Feb 2014 09:47:00 +0000 (10:47 +0100)]
Fix: Dump executable base-address with readlink
The previous approach only worked if the traced executable was invoked
via its fully qualified path. Using readlink to determine the full
qualified path of the traced executable works reliably even when the
traced executable is started via PATH lookup.
Signed-off-by: Paul Woegerer <paul_woegerer@mentor.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Found by Coverity:
CID 1090602 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking "stream" suggests that it may be null,
but it has already been dereferenced on all paths leading to the check
CID 1021261 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)10.
negative_returns: "sysconf(30)" is passed to a parameter that cannot be
negative.
Fix: work-around glibc lying about dlsym()/dlerror() leafness
Especially in the LTTng-UST malloc instrumentation, we run into the
following situation:
1) Our calloc wrapper is called,
2) we setup the static allocator,
3) we call dlsym() to lookup the symbol of the real allocator,
4) dlsym() calls into calloc(), which is overridden by our own wrapper.
Our calloc does not see that the static allocator has been set,
because the stores setting up the static allocator have been optimized
away by gcc-4.8 (in O2), because the dlsym() prototype declares it
with the "leaf" attribute, and thus we end up doing an infinite
recursion, and eventually a segmentation fault.
Thanks to Alexander Monakov for pointing out the culprit of this glibc
bug.
calloc and realloc wrt dlsym and dlerror can trigger segmentation
faults. Ensure that we fully populate the allocator symbols all at once,
and also ensure that we use the static allocator while doing the dlsym
lookups.
David Goulet [Fri, 7 Feb 2014 20:09:12 +0000 (15:09 -0500)]
Fix: add LTTngEvent class to fix delayed logger
This commit introduces a new object called LTTngEvent that represent a
LTTng event containing some attributes, for now loglevel data.
Instead of moving event string name around, this object is created once
and kept in the log handler so once a record is publish we can match
attributes such as loglevels.
This has to be done in order to fix the issue where we have a Logger
that appears later on during runtime (with the timer that poll every 5
seconds). With a created event object we can lookup back the event
attributes and enabled it accordingly. Same goes with the * (all events)
where we now keep the loglevel values process wide so we can force the
new events to use it.
Signed-off-by: David Goulet <dgoulet@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Make sure wait/wakeup stream and channel FDs are closed at teardown.
This led to FD leaks on the consumer daemon when the relay daemon
disconnects unexpectedly.
Recently, commits to fix SDT issues with extern C
(https://bugs.lttng.org/issues/597) brougt in compile errors when the
tracepoint is defined in the same file where the tracepoint provider is
created.
This was due to the presence of extern C guards in tracepoint-event.h, a
header dedicated to tracepoint probe provider compilation. After commits
"Tracepoint probes don't need extern C", it should have gone away. This
is the main fix done by this patch.
This patch also adds missing extern C guards in ust-error.h and
ust-events.h.
Would deal with spaces in the env. var. if there are any. It does not
seem to be important in practice (currently), because automake seems to
fail on CC including spaces at configure time.
Make sure that the ust_baddr_statedump probe is registered prior to
using the tracepoint in lttng_ust_baddr_statedump(). This fix solves the
issue that in rare cases the very first ust_baddr_statedump events were
missing.
Use a reference counting approach that allows constructors/destructors
of the probe to be called many times, as long as the number of calls to
constructor matches the number of calls to destructor.
Reported-by: Paul Woegerer <paul_woegerer@mentor.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paul Woegerer [Tue, 10 Dec 2013 13:07:51 +0000 (14:07 +0100)]
Fix: baddr_statedump tracepoint registration
Ensure baddr_statedump tracepoint registration is completed prior to
using the tracepoint in lttng_ust_baddr_statedump().
Make liblttng-ust-dl robust for explicit baddr_statedump tracepoint
deregistration in lttng_ust_cleanup() (prevent dlopen/dlclose to get
traced if ust_baddr tracepoints are not available).
Signed-off-by: Paul Woegerer <paul_woegerer@mentor.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix RCU races by ensuring every UST source file using RCU read-side lock
is marked as _LGPL_SOURCE. The dynamic binding to urcu-bp relies on the
dynamic loader, and it seems not to behave well when used from
constructors.
Use Userspace RCU with this commit to completely fix baddr races:
"Fix: urcu-bp interaction with threads vs constructors/destructors"
It should use lib_ring_buffer_read_offset_address() to get the packet
being read, rather than lib_ring_buffer_offset_address(), which is only
meant to be used when writing to the packet.
Compile liblttng-ust-baddr c files into liblttng-ust
Move them into liblttng-ust/, where they are now compiled.
This is to ensure we don't rely on statically linked libs (and
associated constructor problems), and that we don't install a shared
object in the system needlessly.
By using the timestamp sampled at space reservation when the packet is
being filled as "end timestamp" for a packet, we can ensure there is no
overlap between packet timestamp ranges, so that packet timestamp end <=
following packets timestamp begin.
Overlap between consecutive packets becomes an issue when the end
timestamp of a packet is greater than the end timestamp of a following
packet, IOW a packet completely contains the timestamp range of a
following packet. This kind of situation does not allow trace viewers
to do binary search within the packet timestamps. This kind of situation
will typically never occur if packets are significantly larger than
event size, but this fix ensures it can never even theoretically happen.
The only case where packets can still theoretically overlap is if they
have equal begin and end timestamps, which is valid.
David Goulet [Wed, 20 Nov 2013 16:35:35 +0000 (11:35 -0500)]
JUL: fix enable all event for delayed Logger
This adds a HashMap containing the enabled Logger names (and wildcard
'*'). This is used to make sure we don't enable twice the same Logger
for the '*' event name (enable all -a).
Signed-off-by: David Goulet <dgoulet@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Jon Bernard [Fri, 15 Nov 2013 14:12:47 +0000 (09:12 -0500)]
Escape minus signs in lttng-ust-cyg-profile manpage
By default, "-" chars are interpreted as hyphens (U+2010) by groff, not
as minus signs (U+002D). Since options to programs use minus signs
(U+002D), this means for example in UTF-8 locales that you cannot cut
and paste options, nor search for them easily.
JP Ikaheimonen [Thu, 7 Nov 2013 10:22:35 +0000 (12:22 +0200)]
Add a check against excluders
When matching enablers with events, first check against all
excluders of the enabler. If the event matches with any of the excluders,
then the event does not match with the enabler.
[ Edit by Mathieu Desnoyers: apply coding style changes. ]
JP Ikaheimonen [Thu, 7 Nov 2013 10:22:34 +0000 (12:22 +0200)]
Add handler for LTTNG_UST_EXCLUSION in UST ABI
Add message handler for the LTTNG_UST_EXCLUSION command in
UST ABI. Copy the exclusion data into a lttng_ust_excluder_node
structure and pass it to the enabler command handler.
JP Ikaheimonen [Thu, 7 Nov 2013 10:22:33 +0000 (12:22 +0200)]
Store exclusions to enablers
Implement a function that adds exclusions to the list in the enabler.
Call this function in the enabler command handler when the
LTTNG_UST_EXCLUSION command is received.
JP Ikaheimonen [Thu, 7 Nov 2013 10:22:32 +0000 (12:22 +0200)]
Add excluders to enabler structure
Define a structure that holds excluders and can be used in lists.
Add a list holding these structures to the enabler structure.
Initialize and destroy the list when the enabler is initialized
and destroyed.
David Goulet [Thu, 7 Nov 2013 21:34:23 +0000 (16:34 -0500)]
Add liblttng-ust-jul for JUL support
The build system creates a jar file named liblttng-ust-jul.jar to be
linked with the Java application. A public library named
liblttng-ust-jul.so is also created and must be in the library path of
the Java application in order for the LTTngAgent to use it for the
tracer's JNI call.
A unit test is also added and integrated with the "make check" command.
Signed-off-by: David Goulet <dgoulet@efficios.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>