Simon Marchi [Mon, 25 Nov 2019 21:14:34 +0000 (16:14 -0500)]
tests: make functions static in test_utils_compat_poll.c
Fixes:
CC test_utils_compat_poll.o
/home/smarchi/src/lttng-tools/tests/unit/test_utils_compat_poll.c:74:6: error: no previous declaration for ‘test_alloc’ [-Werror=missing-declarations]
void test_alloc(void)
^~~~~~~~~~
/home/smarchi/src/lttng-tools/tests/unit/test_utils_compat_poll.c:95:6: error: no previous declaration for ‘test_add_del’ [-Werror=missing-declarations]
void test_add_del(void)
^~~~~~~~~~~~
/home/smarchi/src/lttng-tools/tests/unit/test_utils_compat_poll.c:133:6: error: no previous declaration for ‘test_mod_wait’ [-Werror=missing-declarations]
void test_mod_wait(void)
^~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/tests/unit/test_utils_compat_poll.c:189:6: error: no previous declaration for ‘test_func_def’ [-Werror=missing-declarations]
void test_func_def(void)
^~~~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I1feeed8ee3f76783e22ffedd5292a06deee3e233
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 21:13:30 +0000 (16:13 -0500)]
tests: make functions static in test_utils_expand_path.c
Fixes:
CC test_utils_expand_path.o
/home/smarchi/src/lttng-tools/tests/unit/test_utils_expand_path.c:126:5: error: no previous declaration for ‘prepare_valid_results’ [-Werror=missing-declarations]
int prepare_valid_results(void)
^~~~~~~~~~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/tests/unit/test_utils_expand_path.c:182:5: error: no previous declaration for ‘free_valid_results’ [-Werror=missing-declarations]
int free_valid_results(void)
^~~~~~~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/tests/unit/test_utils_expand_path.c:195:5: error: no previous declaration for ‘prepare_symlink_tree’ [-Werror=missing-declarations]
int prepare_symlink_tree(void)
^~~~~~~~~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/tests/unit/test_utils_expand_path.c:235:5: error: no previous declaration for ‘free_symlink_tree’ [-Werror=missing-declarations]
int free_symlink_tree(void)
^~~~~~~~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I220a2f8dadb355adb4fb974a2f3a0e161b0618e6
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 21:12:21 +0000 (16:12 -0500)]
tests: make functions static in test_session.c
Fixes:
CC test_session.o
/home/smarchi/src/lttng-tools/tests/unit/test_session.c:219:6: error: no previous declaration for ‘test_session_list’ [-Werror=missing-declarations]
void test_session_list(void)
^~~~~~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/tests/unit/test_session.c:225:6: error: no previous declaration for ‘test_create_one_session’ [-Werror=missing-declarations]
void test_create_one_session(void)
^~~~~~~~~~~~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/tests/unit/test_session.c:232:6: error: no previous declaration for ‘test_validate_session’ [-Werror=missing-declarations]
void test_validate_session(void)
^~~~~~~~~~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/tests/unit/test_session.c:258:6: error: no previous declaration for ‘test_destroy_session’ [-Werror=missing-declarations]
void test_destroy_session(void)
^~~~~~~~~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/tests/unit/test_session.c:278:6: error: no previous declaration for ‘test_duplicate_session’ [-Werror=missing-declarations]
void test_duplicate_session(void)
^~~~~~~~~~~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/tests/unit/test_session.c:284:6: error: no previous declaration for ‘test_session_name_generation’ [-Werror=missing-declarations]
void test_session_name_generation(void)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/tests/unit/test_session.c:309:6: error: no previous declaration for ‘test_large_session_number’ [-Werror=missing-declarations]
void test_large_session_number(void)
^~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Ib1f6a004e6feb4693c4331a8b0ce67ee1697703c
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 21:11:26 +0000 (16:11 -0500)]
tests: make functions static in test_uri.c
Fixes:
CC test_uri.o
/home/smarchi/src/lttng-tools/tests/unit/test_uri.c:33:6: error: no previous declaration for ‘test_uri_parsing’ [-Werror=missing-declarations]
void test_uri_parsing(void)
^~~~~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/tests/unit/test_uri.c:201:6: error: no previous declaration for ‘test_uri_cmp’ [-Werror=missing-declarations]
void test_uri_cmp()
^~~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Ia0d7b08a10ec9f8d3f6f2d5b4fa9c4f417827024
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 21:02:06 +0000 (16:02 -0500)]
tests: include foo.h in foo.c
Fixes:
CC foo.lo
/home/smarchi/src/lttng-tools/tests/utils/testapp/userspace-probe-elf-binary/foo.c:19:5: error: no previous declaration for ‘dynamic_symbol’ [-Werror=missing-declarations]
int dynamic_symbol(int a)
^~~~~~~~~~~~~~
Change-Id: I58888da2908bcf4c38d59ba9bacf3e96adc575b6
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 20:14:47 +0000 (15:14 -0500)]
compat: remove always true assertion in compat-poll.c
Fix:
CC compat-poll.lo
In file included from /home/smarchi/src/lttng-tools/src/common/compat/poll.h:21:0,
from /home/smarchi/src/lttng-tools/src/common/compat/compat-poll.c:31:
/home/smarchi/src/lttng-tools/src/common/compat/compat-poll.c: In function ‘compat_poll_wait’:
/home/smarchi/src/lttng-tools/src/common/compat/compat-poll.c:317:31: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits]
assert(events->current.nb_fd >= 0);
^
Change-Id: Ie2b43e64d293d4eadb82db9755dfb64751a1d935
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 9 Dec 2019 19:31:33 +0000 (14:31 -0500)]
Fix: sessiond: RCU read lock imbalance on get trace chunk id error
The error path when cmd_setup_relayd() fails to get the ID of a trace
chunk causes the RCU read lock to be released even though it was never
acquired.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I86aeb99e6cd6ba11634283ab7456a3760a0a6b0d
Simon Marchi [Mon, 25 Nov 2019 21:04:50 +0000 (16:04 -0500)]
tests: add declaration for test_function in userspace-probe-elf-binary.c
Fixes:
CC userspace-probe-elf-binary.o
/home/smarchi/src/lttng-tools/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary.c:21:34: error: no previous declaration for ‘test_function’ [-Werror=missing-declarations]
void __attribute__ ((noinline)) test_function()
^~~~~~~~~~~~~
I did not make test_function static, because from what I understand, it
is important that test_function remains an exported symbol, for example
for test regression/kernel/test_userspace_probe.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I52019f69de023b24b46cc701e2e0df919e654a76
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 21:08:20 +0000 (16:08 -0500)]
tests: add declarations for functions in gen-syscall-events-callstack.c
Fixes:
CC gen-syscall-events-callstack.o
/home/smarchi/src/lttng-tools/tests/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack.c:46:1: error: no previous declaration for ‘my_gettid’ [-Werror=missing-declarations]
my_gettid(void)
^~~~~~~~~
/home/smarchi/src/lttng-tools/tests/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack.c:72:1: error: no previous declaration for ‘fct_c’ [-Werror=missing-declarations]
fct_c(void)
^~~~~
/home/smarchi/src/lttng-tools/tests/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack.c:78:1: error: no previous declaration for ‘fct_b’ [-Werror=missing-declarations]
fct_b(void)
^~~~~
/home/smarchi/src/lttng-tools/tests/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack.c:85:1: error: no previous declaration for ‘fct_a’ [-Werror=missing-declarations]
fct_a(void)
^~~~~
From what I understand, it is important that these symbols stay exported
for test regression/kernel/test_callstack.
Change-Id: I656a4e77bb2653510ba971e94ccc0d8bb65be698
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 21:10:17 +0000 (16:10 -0500)]
tests: make entry_handler static in ini_config test
Fixes:
CC ini_config.o
/home/smarchi/src/lttng-tools/tests/unit/ini_config/ini_config.c:37:5: error: no previous declaration for ‘entry_handler’ [-Werror=missing-declarations]
int entry_handler(const struct config_entry *entry,
^~~~~~~~~~~~~
Change-Id: I937fda691d5ab81bf7567ab50fd90903911dfc57
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 19:17:40 +0000 (14:17 -0500)]
Format lists in src/common/Makefile.am
I'm currently dealing with src/common/Makefile.am, and would find it
more pleasant to modify if the lists were formatted consistently and
sorted (except DIST_SUBDIRS, for which the order is important).
I have taken the liberty to put the corresponding .c and .h on the same
line, since they will always be next to each other. It reduces a bit
the number of lines. If you don't like that, I would also be fine with
a completely flat list.
Change-Id: I8a65fe5e0fea37230f1376c51c7d4a547f651c7e
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 20:46:21 +0000 (15:46 -0500)]
sessiond: make functions static in ust-registry.c
Fixes:
CC ust-registry.o
/home/smarchi/src/lttng-tools/src/bin/lttng-sessiond/ust-registry.c:553:2: error: no previous declaration for ‘ust_registry_lookup_enum’ [-Werror=missing-declarations]
ust_registry_lookup_enum(struct ust_registry_session *session,
^~~~~~~~~~~~~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/src/bin/lttng-sessiond/ust-registry.c:684:6: error: no previous declaration for ‘ust_registry_destroy_enum’ [-Werror=missing-declarations]
void ust_registry_destroy_enum(struct ust_registry_session *reg_session,
^~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Ibaabd16a75f0b7b13a641a571d26ca64aec5317b
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 20:45:12 +0000 (15:45 -0500)]
sessiond: make thread_consumer_management function static
Fixes:
CC manage-consumer.o
/home/smarchi/src/lttng-tools/src/bin/lttng-sessiond/manage-consumer.c:64:7: error: no previous declaration for ‘thread_consumer_management’ [-Werror=missing-declarations]
void *thread_consumer_management(void *data)
^~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Id28f40244e12a618749cc618466fc31d6d773378
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 20:44:15 +0000 (15:44 -0500)]
sessiond: make thread_rotation function static
Fixes:
CC rotation-thread.o
/home/smarchi/src/lttng-tools/src/bin/lttng-sessiond/rotation-thread.c:799:7: error: no previous declaration for ‘thread_rotation’ [-Werror=missing-declarations]
void *thread_rotation(void *data)
^~~~~~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Ia95212a53c658bce5dc6df155eb43ee29b7980c6
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 3 Dec 2019 16:46:24 +0000 (11:46 -0500)]
Fix: build: ust -> kernel mix-up in noinst_SCRIPTS
This is simply a copy paste error as test_notification_ust appears
twice.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: I4e170a092338f5a95479a58d48247088d28d3e31
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 3 Dec 2019 09:59:10 +0000 (04:59 -0500)]
Fix: relayd: missing metadata stream causes all traces to be skipped
Commit
123ed7c22 intends for a trace that doesn't have a metadata
stream to be skipped when creating viewer streams. However, the loop
over ctf_traces should be "continued" rather then "broken" from when
this situation arises. Otherwise, all ctf_traces of the session are
skipped, which is not the intention here.
Moreover, a reference to the current ctf_trace is leaked when the
break (now continue) occurs.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ic630521c6f050c77a78f2c1e20c5741a6b3a66a1
Simon Marchi [Mon, 25 Nov 2019 20:34:21 +0000 (15:34 -0500)]
lttng-ctl: add local declarations for obsolete functions in lttng-ctl.c
The functions concerned by this change are obsolete, but kept to avoid
breaking the ABI. This patch adds local declaration for these functions
to silence the following errors, when building with
-Wmissing-declarations.
CC lttng-ctl.lo
/home/smarchi/src/lttng-tools/src/lib/lttng-ctl/lttng-ctl.c:2815:5: error: no previous declaration for ‘lttng_enable_consumer’ [-Werror=missing-declarations]
int lttng_enable_consumer(struct lttng_handle *handle)
^~~~~~~~~~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/src/lib/lttng-ctl/lttng-ctl.c:2823:5: error: no previous declaration for ‘lttng_disable_consumer’ [-Werror=missing-declarations]
int lttng_disable_consumer(struct lttng_handle *handle)
^~~~~~~~~~~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/src/lib/lttng-ctl/lttng-ctl.c:2831:5: error: no previous declaration for ‘_lttng_create_session_ext’ [-Werror=missing-declarations]
int _lttng_create_session_ext(const char *name, const char *url,
^~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I49750d7646d5823461933c13a9ec4ccef905921c
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 20:43:02 +0000 (15:43 -0500)]
sessiond: remove unused log_job_destruction function
Fixes:
CC rotation-thread.o
/home/smarchi/src/lttng-tools/src/bin/lttng-sessiond/rotation-thread.c:114:6: error: no previous declaration for ‘log_job_destruction’ [-Werror=missing-declarations]
void log_job_destruction(const struct rotation_thread_job *job)
^~~~~~~~~~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I3fce2aceb047a2a251d61e84bff5862be49fe593
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 20:42:04 +0000 (15:42 -0500)]
sessiond: make disable_context static
Fixes:
CC agent.o
/home/smarchi/src/lttng-tools/src/bin/lttng-sessiond/agent.c:833:5: error: no previous declaration for ‘disable_context’ [-Werror=missing-declarations]
int disable_context(struct agent_app_ctx *ctx, enum lttng_domain_type domain)
^~~~~~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I3f8eb7e658e558f7082781c95b4200607e5dad6f
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 20:40:35 +0000 (15:40 -0500)]
sessiond: make ltt_sessions_ht_alloc static
Fixes:
CC session.o
/home/smarchi/src/lttng-tools/src/bin/lttng-sessiond/session.c:305:5: error: no previous declaration for ‘ltt_sessions_ht_alloc’ [-Werror=missing-declarations]
int ltt_sessions_ht_alloc(void)
^~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Iaf4ca32c1f6ca01fa7ad4a1bfc7edd81a90e6adc
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 20:38:19 +0000 (15:38 -0500)]
relayd: make functions static in ctf-trace.c
Fixes:
CC ctf-trace.o
/home/smarchi/src/lttng-tools/src/bin/lttng-relayd/ctf-trace.c:47:6: error: no previous declaration for ‘ctf_trace_destroy’ [-Werror=missing-declarations]
void ctf_trace_destroy(struct ctf_trace *trace)
^~~~~~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/src/bin/lttng-relayd/ctf-trace.c:62:6: error: no previous declaration for ‘ctf_trace_release’ [-Werror=missing-declarations]
void ctf_trace_release(struct urcu_ref *ref)
^~~~~~~~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I4c7ff97b3350d2e50530fb0666c5a7d02599f99f
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 20:35:54 +0000 (15:35 -0500)]
Make validate_url_option_combination static in create.c
Fixes:
CC commands/lttng-create.o
/home/smarchi/src/lttng-tools/src/bin/lttng/commands/create.c:640:5: error: no previous declaration for ‘validate_url_option_combination’ [-Werror=missing-declarations]
int validate_url_option_combination(void)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I091b875fb93d4214c47a1c229e6360ec02a0a2f8
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 20:29:29 +0000 (15:29 -0500)]
Make _utils_expand_path static
It's only used in its own file, so make it static.
Fixes:
CC utils.lo
/home/smarchi/src/lttng-tools/src/common/utils.c:328:7: error: no previous declaration for ‘_utils_expand_path’ [-Werror=missing-declarations]
char *_utils_expand_path(const char *path, bool keep_symlink)
^~~~~~~~~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Ibab3bf9994f29b1a841e9d3ddc9bfce1f8e73032
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 20:28:33 +0000 (15:28 -0500)]
Remove unused function uri_create
Fixes:
CC uri.lo
/home/smarchi/src/lttng-tools/src/common/uri.c:273:19: error: no previous declaration for ‘uri_create’ [-Werror=missing-declarations]
struct lttng_uri *uri_create(void)
^~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I18a58391842c3fba1fa3dd60cf5fe3215280f95a
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 20:26:44 +0000 (15:26 -0500)]
uri: put `inline` at beginning of strpbrk_or_eos declaration
Fixes:
CC uri.lo
/home/smarchi/src/lttng-tools/src/common/uri.c:64:1: error: ‘inline’ is not at beginning of declaration [-Werror=old-style-declaration]
static const inline char *strpbrk_or_eos(const char *s, const char *accept)
^~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I2f753143e65ac4301abc01fba3e9ef122b2d38b7
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Thu, 28 Nov 2019 21:32:16 +0000 (16:32 -0500)]
tests: put `static` keyword at beginning of variable declaration
Fix:
CC select_poll_epoll-select_poll_epoll.o
/home/smarchi/src/lttng-tools/tests/regression/kernel/select_poll_epoll.c:34:1: error: ‘static’ is not at beginning of declaration [-Werror=old-style-declaration]
volatile static int stop_thread;
^~~~~~~~
Change-Id: I2cf1a7d50a01ca0e9226ea527f2e8af70a292f94
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 20:25:39 +0000 (15:25 -0500)]
common: make some functions static in mi-lttng.c
These two functions are only used in the file, so make them static.
Fixes:
CC mi-lttng.lo
/home/smarchi/src/lttng-tools/src/common/mi-lttng.c:367:13: error: no previous declaration for ‘mi_lttng_eventtype_string’ [-Werror=missing-declarations]
const char *mi_lttng_eventtype_string(enum lttng_event_type value)
^~~~~~~~~~~~~~~~~~~~~~~~~
/home/smarchi/src/lttng-tools/src/common/mi-lttng.c:1317:5: error: no previous declaration for ‘mi_lttng_event_userspace_probe’ [-Werror=missing-declarations]
int mi_lttng_event_userspace_probe(struct mi_writer *writer,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are a bunch of other stuff in mi-lttng.c that could be made
static, but those were the only two problematic with
-Wmissing-declarations, because there have no declaration in the .h.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I9f3a6b0f71e86fac7af5d40e553a6944eb768fbe
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 20:17:19 +0000 (15:17 -0500)]
consumerd: make lttng_consumer_close_all_metadata static
It is only used in its file, so make it static. Fixes:
CC consumer.lo
/home/smarchi/src/lttng-tools/src/common/consumer/consumer.c:2177:6: error: no previous declaration for ‘lttng_consumer_close_all_metadata’ [-Werror=missing-declarations]
void lttng_consumer_close_all_metadata(void)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I211a31a7fb5edfb76e90f1209e69bbed5dd5ec92
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 27 Nov 2019 20:30:45 +0000 (15:30 -0500)]
README.md: libuuid is no longer a dependency
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I68ce6b7d210a5f645892267968cd01c8347b2370
Michael Jeanson [Wed, 23 Oct 2019 20:07:37 +0000 (16:07 -0400)]
Replace libuuid with internal implementation
We use a very small subset of libuuid features to transform UUIDs
between their string and binary representation. Plus we have a lot of
compat code for different platforms with some unspecified default
behavior regarding the use of upper/lower case.
Drop the dependency on libuuid and replace it with a minimal internal
implementation that respects RFC4122.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I744e3cf65d6a22d0acf7a9943c10943ba64e8468
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 25 Nov 2019 20:15:46 +0000 (15:15 -0500)]
consumerd: remove unused function consumer_del_data_stream
Fix:
CC consumer.lo
/home/smarchi/src/lttng-tools/src/common/consumer/consumer.c:712:6: error: no previous declaration for ‘consumer_del_data_stream’ [-Werror=missing-declarations]
void consumer_del_data_stream(struct lttng_consumer_stream *stream)
^~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I92a47e069055713eaa4fdbc7f034a8f8e439f283
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Fri, 4 Oct 2019 16:18:05 +0000 (12:18 -0400)]
m4: sync ax_pthread.m4 with autoconf archive
Sync with [1].
In particular, this lets us configure with -Wunused-but-set-parameter.
[1] https://raw.githubusercontent.com/autoconf-archive/autoconf-archive/
62e8491dbc174113a04fe910cad1e92e8a9e2164/m4/ax_pthread.m4
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Id9a6eb7cd0b8c7597ae6abb5587078afdaa420f6
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Mon, 27 May 2019 15:52:46 +0000 (11:52 -0400)]
configure.ac: Remove duplicated CMD_DESCR_ROTATE definition
CMD_DESCR_ROTATE is defined twice by configure. This breaks configuring
with "-Werror -Wall", as some test programs don't compile due to:
configure:16990: gcc -o conftest -Wall -Werror conftest.c >&5
conftest.c:163: error: "CONFIG_CMD_DESCR_ROTATE" redefined [-Werror]
#define CONFIG_CMD_DESCR_ROTATE "Archive a tracing session’s current trace chunk"
conftest.c:154: note: this is the location of the previous definition
#define CONFIG_CMD_DESCR_ROTATE "Archive a tracing session's current trace chunk"
cc1: all warnings being treated as errors
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 25 Nov 2019 23:58:56 +0000 (18:58 -0500)]
Fix: tests: missing argument in test output print statement
The format string of this print statement uses a string and none
is provided. This results in a crash when running on ARM64
test boards.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 25 Nov 2019 22:54:07 +0000 (17:54 -0500)]
Silence bogus warning when building with old GCC versions
gcc version 7.4.0 (and possibly others) warn that `new_handle`
may be used uninitialized. It is not clear what code path would
trigger this uninitialized use.
Moreover, the warning is not present when building with recent
versions of gcc and clang, nor is it flagged by Coverity. This points
to the warning being bogus.
Still, setting `new_handle` to NULL silences the warning on this
gcc version.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 25 Nov 2019 22:03:29 +0000 (17:03 -0500)]
Clean-up: open_pipe_cloexec() has useless boilerplate
The open_pipe_cloexec() wrapper can be simplified to simply call
utils_create_pipe_cloexec(). This eliminates a warning of Coverity.
1407700 Identical code for different branches
The condition is redundant
In open_pipe_cloexec: The same code is executed regardless of the condition (CWE-398)
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 25 Nov 2019 22:01:19 +0000 (17:01 -0500)]
Clean-up: tests: unchecked closedir value in test_fd_tracker
closedir's return value is not checked in a utility function
of the test_fd_tracker unit test.
1407702 Unchecked return value
If the function returns an error value, the error value may be mistaken for a normal value.
In fd_count: Value returned from a function is not checked for errors before being used (CWE-252)
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 25 Nov 2019 21:40:10 +0000 (16:40 -0500)]
Fix: fd-tracker: dereference of lttng_inode after NULL check
handle->inode is checked for NULL but used unconditionaly
on line 873 (lttng_inode_put).
1407756 Dereference after null check
Either the check against null is unnecessary, or there may be a null pointer dereference.
In fs_handle_close: Pointer is checked against null but then dereferenced anyway (CWE-476)
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 25 Nov 2019 19:37:54 +0000 (14:37 -0500)]
Fix: fd-tracker: error path lead to null dereference of handle
A number of fd_tracker_open_fs_handle() error paths can lead to a NULL
pointer dereference. The error paths are separated to cover the
various initialization stages of an fs_handle.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 25 Nov 2019 19:37:38 +0000 (14:37 -0500)]
Fix: fd-tracker: crash on close of partially initialized handle
A number of internal functions are used in the error path of the
creation of an fs_handle. Since the fs_handle is partially
initialized, those functions need to be adapted to handle cases where
internal members are NULL.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 23 Nov 2019 00:30:39 +0000 (19:30 -0500)]
Tests: add fd-tracker tests for the unlink operation
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 23 Nov 2019 00:25:36 +0000 (19:25 -0500)]
fd-tracker: use lttng_inode to store fs_handle's path
Storing paths as part of the lttng_inode object, which may be shared
by multiple fs_handles reduces the number of copies of the path.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 23 Nov 2019 00:12:27 +0000 (19:12 -0500)]
fd-tracker: add the lttng-inode interface
The lttng-inode interface is internal to the fd-tracker. It allows
unlink operations on an fs_handle to determine if another fs_handle
refers to the same file.
When this is deemed to be the case, the unlink can be delayed by
renaming the file to a temporary name and, finally, unlinking it
when all references have been released.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 23 Nov 2019 00:08:18 +0000 (19:08 -0500)]
fd-tracker: add the unlink operation to fs handles
The unlink method allows user to unlink the file refered-to by
an fs_handle. As indicated in the comments, the unlink operation
leverages the lttng_inode to ensure the actual unlink system call
is only performed when the last reference to an lttng_inode is
released by an fs_handle.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 22 Nov 2019 23:54:58 +0000 (18:54 -0500)]
Test: add a unit test for the fd tracker
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 22 Nov 2019 23:52:03 +0000 (18:52 -0500)]
fd-tracker: add pipe management wrappers to fd-tracker
Add wrappers to allow the creation of a pipe the two ends of
which are tracked by an fd-tracker.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 22 Nov 2019 23:46:47 +0000 (18:46 -0500)]
fd-tracker: add epoll/poll management wrappers to fd-tracker
Add wrappers which create an lttng_poll_event object, tracking
any file descriptor created in the process of initializing
the object.
When the build is configured to use the epoll interface, the
underlying epoll fd is tracked by the fd-tracker.
If the build is configured to use the poll interace, the fd tracker is
not involved in the process and the utility will simply defer the call
to lttng_poll_create() directly.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 22 Nov 2019 23:41:09 +0000 (18:41 -0500)]
fd-tracker: add an fd-tracker util to common
This commit adds an fd-tracker utility to the common libs.
This interface allows a process to keep track of its open
file descriptors and enforce a limit to the number of file
descriptors that may be simultaneously opened.
The intent is to use this interface as part of the relay daemon
to mitigate file descriptors exhaustion problems that are
encountered when the relay has to handle a large number of streams.
The fd-tracker defines two classes of file descriptors: suspendable
and unsuspendable file descriptors.
Suspendable file descriptors are handles to filesystem objects
(e.g. regular files) that may be closed and re-opened later without
affecting the application.
A suspendable file descriptor can be opened by creating a filesystem
handle (fs_handle) using the fd-tracker. The raw file descritptor
must then be obtained and released using that handle. Closing the
handle will effectively ensure that the file descritptor is closed.
Unsuspendable file descriptors are file descriptors that cannot
be closed without affecting the application's state. For instance,
it is not possible to close and re-open a pipe, a TCP socket, or
an epoll fd without involving some app-specific logic. Thus, the
fd-tracker considers those file descriptors as unsuspendable.
Opening an unsuspendable file descritptor will return a raw file
decriptor to the application. It is its responsability to notify the
fd-tracker of the file descriptor's closing to ensure the number
of active file descriptors can be tracked accurately.
If a request to open a new file descriptors is made to the fd-tracker
and the process has already reached its maximal count of
simultaneously opened file descriptors, an attempt will be made to
suspend a suspendable file descriptor to release a slot.
Suspending a file descriptor involves:
- verifying that the file is still available on the FS (restorable),
- sampling its current position,
- closing the file descriptor.
Note that suspending a file descriptor eliminates the POSIX guarantee
that a file may be unlinked at any time without affecting the
application (provided that it holds an open FD to that
file). Applications using the fd-tracker that need to maintain this
guarantee should open those files as unsuspendable file descriptors.
To protect against unlinking and file replacement scenarios, the
fd-tracker samples the files' inode number when a fs_handle is
created. This inode number will then be checked anytime the handle
is suspended or restored to ensure that the application is made
aware of the file's unavailability. This is preferable to
inadvertently opening another file of the same name if the original
file was unlinked and/or replaced between a fs_handle's suspension
and restoration.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 23 Nov 2019 00:20:22 +0000 (19:20 -0500)]
relayd: close stdin on launch
The relay daemon has no use for the standard input; it can be safely
closed early on launch.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 23 Nov 2019 00:04:16 +0000 (19:04 -0500)]
Fix: relayd: fully initialize viewer stream before publishing it
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 22 Nov 2019 23:37:28 +0000 (18:37 -0500)]
Clean-up relayd: session_release can be marked as static
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Tue, 12 Nov 2019 22:55:25 +0000 (17:55 -0500)]
Fix: relayd: don't send streams if there is no metadata
Issue
=====
When tracing short-live UST apps in per-pid mode, it happens that traces
are closed before we can send all the streams to the viewer. This can
place the viewer in an uncomfortable position where it is aware of data
streams of a trace but can't get the metadata stream to decode the
events.
Solution
========
Only send the data streams if we have the metadata stream or if the
metadata stream was already sent. This ensures that the viewer will
either have all the {data,metadata} streams or none of them.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Mon, 18 Nov 2019 20:12:20 +0000 (15:12 -0500)]
Fix: update apps on untrack only when session is active
This mimics what is done on the track side.
Fixes #1210
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 22 Nov 2019 20:08:15 +0000 (15:08 -0500)]
Fix: consumerd: assert on null trace chunk on session restart
The consumer daemon asserts on
`stream->net_seq_idx != (uint64_t) 1ULL || stream>trace_chunk'
when a session is re-started following a rotation.
Steps to reproduce, while an instrumented application is running:
$ lttng create
$ lttng enable-event -u -a
$ lttng start
$ lttng stop
$ lttng rotate
$ lttng start
-> assertion fails
The trace chunk of a stream can be null in this scenario as the
"create trace chunk" consumer command immediately sets the streams'
current trace chunk when they are transitioning from a "null" trace
chunk.
Since
1f4962443, a session restart will cause a rotation to occur from
"null" to the streams' new trace chunk. When this rotation occurs, the
channel and their streams are seen to be in the same trace chunk.
This is unexpected as this should only occur when transitioning from a
trace chunk to the "null" trace chunk (no output). In that case, the
streams are considered to have reached the point where they should
discard their current trace chunk to enter the "null trace chunk"
state (having no current output). This is exactly the opposite of
the situation here as streams are transitioning from a null to a
non-null trace chunk.
Hence, the immediate assignation of the trace chunk to the streams
should no longer be performed on creation of a trace chunk on the
consumer daemon. The streams transition from the "null" trace chunk to
a new trace chunk through the "rotate channel" command as is done for
all other rotation operations. Removing this bypass also ensures that
the rotation behaviour of both the consumer and relay daemons match.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 20 Nov 2019 21:09:50 +0000 (16:09 -0500)]
Fix: sessiond: don't wait for a rotation from a null chunk to finish
The rotation completion checking does not handle waiting for the
completion of a rotation _from_ a NULL trace chunk. This is correct as
there is essentially nothing to check. Streams always rotate out of a
null trace chunk immediately as it means the stream had no output and
could not receive data.
Concretely, this happens when stopping a session, rotating, and
re-starting a session.
The fix consists in simply re-working the logic of the "rotate"
command to not launch a rotation completion check job and not put the
session in the "rotation ongoing" state.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 20 Nov 2019 21:06:30 +0000 (16:06 -0500)]
Fix: sessiond: duplicated rotation notification sent
A duplicate notification that a rotation was launched and completed
is sent by the rotation thread when a rotation is performed after
a session was stopped.
This code is removed at it is a left-over from the time when the
rotation thread had to explicitly rename trace output folders
when a rotation had completed.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 19 Nov 2019 18:41:51 +0000 (13:41 -0500)]
Fix: relayd: remove assert of non-null stream trace chunk on rotate
A stream can rotate from a "NULL" trace chunk to a new trace chunk
and the relay daemon should not assert on this condition.
This happens when a session is stopped, rotated, and started again
later on.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 18 Nov 2019 21:09:21 +0000 (16:09 -0500)]
Docs: verb/noun confusion in comment
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 18 Nov 2019 21:01:44 +0000 (16:01 -0500)]
Fix: sessiond: no rotation performed from null chunk to new chunk
The session daemon must rotate from a null trace chunk to a new trace
chunk when a session's current trace chunk is null. This situation
happens when a session is stopped, rotated, and started again.
This bug leaves existing streams in the "null" trace chunk and causes
the relay daemon to report a protocol error on the reception of the
first data packet following such a start.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 18 Nov 2019 19:43:06 +0000 (14:43 -0500)]
Fix: invalid use of destructor in dynamic pointer array
A dynamic pointer array is built on top of a dynamic array and uses
the dynamic array's internal "destructor" field to store the
user-specified destructor.
lttng_dynamic_pointer_array_remove_pointer currently uses
the dynamic array's remove_element directly which causes the
user destructor to be called with the underlying storage of the
pointer rather than with the pointer itself.
This change re-uses the same pattern as
lttng_dynamic_pointer_array_reset(), namely using the destructor
explicitly and setting it to NULL for the duration of the call to
the dynamic array API.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 15 Nov 2019 22:16:32 +0000 (17:16 -0500)]
Fix: relayd: check for a trace chunk before writing a packet
Protocol errors can cause a packet to be written to a stream that
doesn't have an active trace chunk. Validate this condition for the
init and write packet operations on a stream.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 14 Nov 2019 22:12:08 +0000 (17:12 -0500)]
Fix: relayd: viewer session trace chunk not released on detach
The 'attach' command on a viewer session expects (asserts) the trace
chunk of the viewer session to be NULL. This is reasonable as there is
no reason to hold a reference to a trace chunk while no clients are
attached.
Release the reference to the trace chunk on detach. The relay
session's trace chunk will be re-sampled (copied) when the next client
attaches to the viewer session.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 7 Nov 2019 19:02:55 +0000 (14:02 -0500)]
Require automake >= 1.12
The test suite LOG_DRIVER statement requires that automake >= 1.12 be used
during bootstrap.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 12 Nov 2019 21:28:50 +0000 (16:28 -0500)]
relayd: rename viewer_session_set_trace_chunk and hide it
viewer_session_set_trace_chunk() is renamed to
viewer_session_set_trace_chunk_copy() as it creates a copy of the
source trace chunk before setting it on a viewer_session.
The function is also marked static as it is only needed within
the viewer-session.c TU.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 12 Nov 2019 04:38:25 +0000 (23:38 -0500)]
Fix: relayd: session trace chunk is copied too late
In per-pid buffering mode, a viewer can attach to a session while it
is active and find it has been closed by the time it requests new
streams. The viewer session's trace chunk is created as a side-effect
of the "get_new_streams" command and can find that the relay_session's
trace chunk has now been closed, causing the creation of the viewer
session trace chunk to fail.
This results in an unexpected error being reported to the live client.
This fix moves the creation of the viewer session's trace chunk to the
"attach" command. If the creation fails, the session is reported as
being "unknown".
Reported-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tested-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Jérémie Galarneau [Mon, 11 Nov 2019 23:53:56 +0000 (18:53 -0500)]
Fix: overly restrictive datetime regexp rejects valid dates
The patch introducting backward_compat_group_by_session() was
edited (by me) before being merged and the regular expression was
made stricter. However, one of the changes was erroneous and
restricted the range of the second digit of the 'month' field
to [0-1].
Change it back to [0-9] to accept all months from 1-12.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 8 Nov 2019 22:45:20 +0000 (17:45 -0500)]
Fix: relayd: disallow 0-length session names for 2.4+ peers
The group-by-session-name feature assumes sessions are named for peers
more recent than 2.3. Enforce this assumption at session creation
time.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Wed, 27 Jun 2018 00:48:24 +0000 (20:48 -0400)]
Docs: RELAYD(8): document the --group-output-by-session/host options
Add the description of the newly-introduced --group-output-by-session
and --group-output-by-host options.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Thu, 19 Sep 2019 21:26:06 +0000 (17:26 -0400)]
Tests: unit testing for backward compatibility of group-output-by-session
These unit tests aim to reproduce the stream path received by
lttng-relayd when dealing with a producer using a protocol version < 2.11.
We then pass them through the transform function for
--group-output-by-session used when producer are using protocol version
greater or equal to 2.4 and small than 2.11.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Thu, 19 Sep 2019 20:56:53 +0000 (16:56 -0400)]
relayd: Add backward compatibility for --group-output-by-session
The current implementation works for producer (consumerd/lttng-sessiond)
using protocol version >= 2.11.
For producer using protocol version >= 2.4 and < 2.11, we can use the
session name passed on the RELAYD_CREATE_SESSION command to infer
information (creation datetime, base path) from the stream path passed on
the RELAYD_ADD_STREAM command. That information is then used to craft a
stream path, in a best effort manner, that comply with the
--group-output-by-session requirements:
<session_name>/<hostname>-<datetime>/trace
Prior to protocol version 2.4, the session name is unknown on lttng-relayd
side. In those cases, we do not perform any transformation and leave the
provided stream path as is. A warning (lttng-relayd) is emitted on such
occasions.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Thu, 19 Sep 2019 21:00:51 +0000 (17:00 -0400)]
Tests: regression testing for lttng-relayd --group-output-by-*
Each test is run for --group-output-by-host and
--group-output-by-session and also with automatic session name and
specific session name.
No need to test against kernel. Tracing domain does not have any influence
at lttng-relayd level.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Fri, 22 Jun 2018 17:51:58 +0000 (13:51 -0400)]
Tests: lttng_snapshot_add_output_ok: allow specifying output type
Also add support for additional options.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Thu, 19 Sep 2019 20:56:11 +0000 (16:56 -0400)]
relayd: introduce --group-output-by-session
LTTng-relayd now support the grouping of traces per session.
This mode can be used via the "--group-output-per-session" switch.
The default, and current way, of grouping is done around the host
(hostname) of the traced system.
When grouped by host the following folder hierarchy is mostly found on the filesystem:
<hostname>/<session_name>-<datetime>/<trace>
When using "--group-output-per-session", the following hierarchy is
found on the filesystem:
<session_name>/<hostname>-<datetime>/<trace>
We also need to support base path information that come from the URIs
set at the client level:
lttng create --set-url=net://localhost/extra/path/information
When grouping by host (current behaviour), it result in the following
hierarchy:
<hostname>/<base_path>/<trace>
e.g:
<hostname>/extra/path/information/<trace>
We want to part from this way of handling the base path since it can lead
to unexpected conflict between session.
When grouping by session using a base path, the following hierarchy is
produced:
<session_name>/<hostname>-<datetime>/<base_path>/<trace>
e.g:
<session_name>/<hostname>-<datetime>/extra/path/information/<trace>
We encourage user to move away from using base path entirely as it
bypasses introduces potential name clashes and completely bypasses the
relay daemon's storage policy.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Fri, 1 Nov 2019 20:23:05 +0000 (16:23 -0400)]
Fix: sessiond: ust: deadlock with per-pid buffers
Do not hold the registry lock while communicating with the consumerd,
because doing so causes inter-process deadlocks between consumerd and
sessiond with the metadata request notification.
The deadlock involves both sessiond and consumerd:
* lttng-sessiond:
thread 11 - thread_application_management
close_metadata()
pthread_mutex_lock(®istry->lock);
consumer_close_metadata()
pthread_mutex_lock(socket->lock);
thread 15 - thread_consumer_management
ust_consumer_metadata_request()
pthread_mutex_lock(&ust_reg->lock);
thread 8 - thread_manage_clients
consumer_is_data_pending
pthread_mutex_lock(socket->lock);
consumer_socket_recv()
* lttng-consumerd:
thread 4 - consumer_timer_thread
sample_channel_positions()
pthread_mutex_lock(&stream->lock);
thread 8 - consumer_thread_sessiond_poll
consumer_data_pending
pthread_mutex_lock(&consumer_data.lock);
pthread_mutex_lock(&stream->lock);
thread 7 - consumer_thread_data_poll
lttng_consumer_read_subbuffer
pthread_mutex_lock(&stream->chan->lock);
pthread_mutex_lock(&stream->lock);
do_sync_metadata
pthread_mutex_lock(&metadata->lock);
lttng_ustconsumer_sync_metadata
pthread_mutex_unlock(&metadata_stream->lock);
lttng_ustconsumer_request_metadata()
pthread_mutex_lock(&ctx->metadata_socket_lock);
lttcomm_recv_unix_sock()
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 6 Nov 2019 19:43:18 +0000 (14:43 -0500)]
relayd: close viewer stream trace chunk earlier on release
A viewer stream puts its references to its stream and index files
within its "release" method (called when its reference count reaches
0).
However, the reference to its trace chunk is only released during the
RCU reclamation of the viewer stream. This unnecessarily delays the
clean-up of the viewer trace chunk.
For cleanliness' sake, move the release of the viewer stream's trace
chunk to the release method, just after the release of the various
file handles of that stream.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Fri, 1 Nov 2019 20:23:04 +0000 (16:23 -0400)]
Fix: relayd: put chunk reference when closing stream
If a stream is closed by an application exiting (per-pid buffers), it
needs to put its reference on the stream trace chunk right away, because
otherwise still holding the reference on the trace chunk could allow a
viewer stream (which holds a reference to the stream) to postpone
destroy waiting for the chunk to cease to exist endlessly until the
viewer is detached.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Fri, 1 Nov 2019 20:23:03 +0000 (16:23 -0400)]
Fix: relayd: tracefile rotation: viewer opening missing index file
Moving the head position of the tracefile array when the data is
received opens a window where a viewer attaching to the session could
try to open a missing index file (which has not been received yet).
However, we want to bump the tail position as soon as we receive
data, because the prior tail is not valid anymore.
Solve this by introducing two head positions: the "read" head
and the "write" head. The "write" head is the position of the
newest data file (equivalent to the prior "head" position). We
also introduce a "read" head position, which is only moved
forward when the index is received.
The viewer now uses the "read" head position as upper bound, which
ensures it never attempts to open a non-existing index file.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Fri, 25 Oct 2019 22:12:04 +0000 (18:12 -0400)]
Tests: fix shellcheck warning
No need to use random string for session name here, use the test name.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Fri, 25 Oct 2019 22:12:03 +0000 (18:12 -0400)]
Tests: base path: lttng load for session configuration
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Fri, 25 Oct 2019 22:12:02 +0000 (18:12 -0400)]
Cleanup: remove unused internal lttng_session_descriptor_get_base_path
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Fri, 25 Oct 2019 22:12:01 +0000 (18:12 -0400)]
Refactor: Move set session path to own function
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Fri, 25 Oct 2019 22:12:00 +0000 (18:12 -0400)]
Fix: move set base_path of session to URI configuration
The load code still uses the "old" API to create and configure network
session output (lttng_create_session followed by
lttng_set_consumer_url). The session base_path is only set in the
cmd_create_session_from_descriptor function. This results in invalid
network output paths when using a loaded session configuration (xml).
While we might want to move the load code to the new API, there is a
case to be made in not breaking the previous API behaviour.
To restore the expected behaviour of lttng_set_consumer_url, move the
assignation of the session base_path to the cmd_set_consumer_uri
function (LTTNG_SET_CONSUMER_URI).
Both the previous and session descriptor based creation API uses this
code path when needed (network output).
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 5 Nov 2019 16:30:24 +0000 (11:30 -0500)]
Fix: tests: re-add link to urcu-bp for _LGPL_SOURCE tests
Tests with tracepoints defined with _LGPL_SOURCE require to be
explicitly linked against urcu-bp.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 24 Oct 2019 15:36:33 +0000 (11:36 -0400)]
Fix: tests: use DL_LIBS variable in ust multi-lib test
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Fri, 25 Oct 2019 21:56:26 +0000 (17:56 -0400)]
Fix: lttng: initialize sessions pointer to NULL
lttng_list_sessions does not set the passed pointer to NULL on empty
return. This leads to a deallocation of an invalid pointer (segfault).
For returns of size 0, the value of the passed argument should be
considered "undefined".
Refactor error handling a bit by removing the "error" jump. Always
call free on the 'sessions' object.
Fixes #1205
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 24 Oct 2019 15:36:22 +0000 (11:36 -0400)]
Use pkgconfig to detect and configure liblttng-ust
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 31 Oct 2019 20:12:46 +0000 (16:12 -0400)]
Fix: check for dtrace and sdt.h before enabling SDT uprobe tests
Add a configure switch '--enable-sdt-uprobe / --disable-sdt-uprobe', the
default behavior of enabling the test if the requirements are found is
kept but it's now possible to explicitly disable it.
Also add the detection of the dtrace binary and its override trough the
DTRACE environment variable.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Wed, 30 Oct 2019 19:35:28 +0000 (15:35 -0400)]
Fix: consumerd: crash occurs when taking snapshot of ust channel
Commit
8e1ef46e8 added an acquisition of the metadata_stream's lock
during consumer_metadata_cache_flushed() as stream attributes are
used. However, when this function is called, the metadata channel's
stream can already be NULL, as indicated by the function's comments.
Check if the stream is NULL before attempting to acquire its lock.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 29 Oct 2019 19:57:59 +0000 (15:57 -0400)]
Fix: trace-chunk: log the cause of file open failures
Use the PERROR macro instead of ERR to obtain the "errno" message
when an error occurs while opening a file relative to a trace
chunk.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 29 Oct 2019 03:57:01 +0000 (23:57 -0400)]
Fix: relayd: live: crash when creating viewer streams
Viewer streams can be creating while serving a "GET_STREAMS" viewer
client command for a session that is being destroyed. If this happens,
the viewer streams will be created with a NULL viewer trace chunk,
which would result in a crash.
The fix consists in returning a stream error when such a command
happens during the destruction of a session. This is the same
behaviour than if the session could not be found at all, introducing
no meaningful change in behaviour from the viewer's perspective.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 29 Oct 2019 03:32:36 +0000 (23:32 -0400)]
Fix: relayd: live: crash on attach to a session without trace chunk
Attaching to a session that doesn't have a current trace chunk results
in a crash when the viewer streams are created from a NULL viewer
trace chunk.
Live clients are prevented from attaching to sessions without a
current trace chunk as those sessions are either being destroyed or
too young to have a trace chunk, meaning that they don't have streams
yet. Live clients will receive the "unknown" status code that they
already receive when asking an unknown session. Since such sessions
are not listed, this shouldn't change any exposed behaviour.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Tue, 29 Oct 2019 03:29:53 +0000 (23:29 -0400)]
Fix: relayd: live: some listed sessions are not attacheable
The list sessions command currently returns sessions that do not
have a current trace chunk. This can be caused by the session
either being destroyed or being so young that it hasn't had a
trace chunk created against it yet.
In both cases, such sessions would not be attacheable in their
current condition. This fix omits them from from the listing
to reduce the number of failures at the "attach session" and
"attach stream" step.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 28 Oct 2019 20:53:48 +0000 (16:53 -0400)]
Fix: relayd: don't put un-acquired trace chunk reference
stream_create() should not release (put) the reference to the current
trace chunk in its error path if it could not acquire a new reference
in the first place.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 28 Oct 2019 20:26:48 +0000 (16:26 -0400)]
Fix: relayd: don't put un-acquired viewer trace chunk reference
viewer_stream_create() should not release (put) the reference to
the viewer_trace_chunk in its error path if it could not acquire
a new reference in the first place.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 28 Oct 2019 19:37:34 +0000 (15:37 -0400)]
Fix: consumerd: NULL pointer dereference during metadata sync
The following crash was reported when short-lived applications
are traced in a live session with per-pid buffering channels.
From the original report:
```
Thread 1 (Thread 0x7f72b67fc700 (LWP
1912155)):
#0 0x00005650b3f6ccbd in commit_one_metadata_packet (stream=0x7f729c010bf0) at ust-consumer.c:2537
#1 0x00005650b3f6cf58 in lttng_ustconsumer_sync_metadata (ctx=0x5650b588ce60, metadata=0x7f729c010bf0) at ust-consumer.c:2608
#2 0x00005650b3f4dba3 in do_sync_metadata (metadata=0x7f729c010bf0, ctx=0x5650b588ce60) at consumer-stream.c:471
#3 0x00005650b3f4dd3c in consumer_stream_sync_metadata (ctx=0x5650b588ce60, session_id=0) at consumer-stream.c:548
#4 0x00005650b3f6de78 in lttng_ustconsumer_read_subbuffer (stream=0x7f729c0058e0, ctx=0x5650b588ce60) at ust-consumer.c:2917
#5 0x00005650b3f45196 in lttng_consumer_read_subbuffer (stream=0x7f729c0058e0, ctx=0x5650b588ce60) at consumer.c:3524
#6 0x00005650b3f42da7 in consumer_thread_data_poll (data=0x5650b588ce60) at consumer.c:2894
#7 0x00007f72bdc476db in start_thread (arg=0x7f72b67fc700) at pthread_create.c:463
#8 0x00007f72bd97088f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
The segfault happen on the access to 'stream->chan->metadata_cache->lock'
chan value here is zero.
```
The problem is easily reproducible if a sleep(1) is added just after
the call to lttng_ustconsumer_request_metadata(), before the metadata
stream lock is re-acquired.
During the execution of the "request_metadata", an application can
close. This will cause the session daemon to push any remaining
metadata to the consumer daemon and to close the metadata channel.
Closing the metadata channel closes the metadata stream's wait_fd,
which is an internal pipe. The closure of the metadata pipe is
detected by the metadata_poll thread, which will ensure that all
metadata has been consumed before issuing the deletion of the metadata
stream and channel.
During the deletion, the channel's "stream" attribute the stream's
"chan" attribute are set to NULL as both are logically deleted and
should not longer be used.
Meanwhile, the thread executing commit_one_metadata_packet()
re-acquires the metadata stream lock and trips on the now-NULL "chan"
member.
The fix consists in checking if the metadata stream is logically
deleted after its lock is re-acquired. It is correct for the
sync_metadata operation to then complete successfully as the metadata
is synced: the metadata guarantees this before deleting the
stream/channel.
Since the metadata stream's lifetime is protected by its lock, there
may be other sites that need such a check. The lock and deletion check
could be combined into a single consumer_stream_lock() helper in
follow-up fixes.
Reported-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Mon, 28 Oct 2019 18:52:44 +0000 (14:52 -0400)]
consumerd: clean-up: stream attribute accessed without locking stream
consumer_metadata_cache_flushed makes use of the metadata stream's
ust_metadata_pushed attribute without locking while it is updated by
commit_one_metadata_packet() which holds the metadata stream lock.
This is marked as a clean-up since the attribute appears to always be
accessed while the metadata cache lock is held. However this is a
_channel_ attribute and the stream and channel lifetimes do not match,
making the locking assumptions conceptually dubious.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 24 Oct 2019 21:06:17 +0000 (17:06 -0400)]
Tests: namespace tests fail to build on older libc
The namespace tests fail to build on older libcs that don't define the
various namespace clone flags. To circumvent this problem, local
definitions from Linux's sched.h are added.
The kernel's support of the various namespaces is tested by the test
runner. Hence, it is not a problem to build these test application
against a kernel that isn't configured to support (some of) those
namespaces; the applications are not invoked for unsupported
namespaces.
Acked-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Wed, 23 Oct 2019 15:08:34 +0000 (11:08 -0400)]
Fix: check for lttng-ust >= 2.11 at configure
We don't support building lttng-tools against an older version of
lttng-ust, make this check explicitly at configure.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Thu, 24 Oct 2019 00:27:12 +0000 (20:27 -0400)]
sessiond: build fails in --without-lttng-ust configuration
The include of macros.h was changed when syncing with the latest
usb-abi.h header and caused the build to fail in the
--without-lttng-ust configuration.
Changed the include to refer to common/macros.h.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jonathan Rajotte [Tue, 15 Oct 2019 20:50:46 +0000 (16:50 -0400)]
Tests: use "kill -0" for app existence check in NS tests
Removing the sleep 0.5 we hit a race where the "-f /proc/$pid_app"
test returns false immediately. Using "kill -0" protects us against
such races. From kill (2):
If sig is 0, then no signal is sent, but existence and permission
checks are still performed; this can be used to check for the
existence of a process ID or process group ID that the caller is
permitted to signal.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.082299 seconds and 5 git commands to generate.