Fix: Skip uid registry when metadata key value is 0
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 9 Aug 2018 21:21:40 +0000 (17:21 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 20 Dec 2019 05:28:30 +0000 (00:28 -0500)
A value of 0 for the metadata key indicates that the metadata channel
was never created/pushed on the consumer side.

This can occur in scenario where a tracker(s) (vuid/vgid/vpid) is present.
The metadata channel might never be created/pushed since no applications
are actually tracing. Still, the uid registry exists due to the order
in which the sessiond received the client commands (create,
enable-channel, lttng track/untrack).

See included test for a complete reproducer.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: Id7ef34ebc48333f47db4bdca907cf81911b60d1d
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/ust-app.c
tests/regression/tools/tracker/test_event_tracker

index d0980220d1519d9e5578b062c7fa1998ea65e8c5..b1dba0a09cf755384b4c80f4a6491a485160b8f0 100644 (file)
@@ -6343,6 +6343,11 @@ enum lttng_error_code ust_app_rotate_session(struct ltt_session *session)
                        struct buffer_reg_channel *reg_chan;
                        struct consumer_socket *socket;
 
+                       if (!reg->registry->reg.ust->metadata_key) {
+                               /* Skip since no metadata is present */
+                               continue;
+                       }
+
                        /* Get consumer socket to use to push the metadata.*/
                        socket = consumer_find_socket_by_bitness(reg->bits_per_long,
                                        usess->consumer);
index 0daa2f8b5436dc26ae92f04a4a46d8fcf2d325b6..b4563b333c26a443440703bb11629b667ea310cc 100755 (executable)
@@ -28,7 +28,7 @@ TESTAPP_KERNEL_BIN="$TESTAPP_PATH/$TESTAPP_KERNEL_NAME/$TESTAPP_KERNEL_NAME"
 SESSION_NAME="tracker"
 NR_ITER=100
 NUM_GLOBAL_TESTS=2
-NUM_UST_TESTS=256
+NUM_UST_TESTS=265
 NUM_KERNEL_TESTS=462
 NUM_TESTS=$((NUM_UST_TESTS+NUM_KERNEL_TESTS+NUM_GLOBAL_TESTS))
 
@@ -345,6 +345,36 @@ function test_event_pid_track_untrack()
        rm -rf "$trace_path"
 }
 
+function test_event_ust_vpid_untrack_snapshot()
+{
+       local trace_path
+
+       trace_path=$(mktemp -d)
+
+       diag "Test_event_ust_vpid_untrack_snapshot"
+
+       create_lttng_session_ok $SESSION_NAME "$trace_path" "--snapshot"
+
+       enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME"
+
+       prepare_ust_app
+
+       lttng_untrack_ust_ok "--vpid --all"
+
+       start_lttng_tracing_ok
+
+       trace_ust_app
+       lttng_snapshot_record $SESSION_NAME
+
+       stop_lttng_tracing_ok
+       destroy_lttng_session_ok $SESSION_NAME
+
+       snapshot_count=$(find "$trace_path" -name metadata | wc -l)
+       is "$snapshot_count" 0 "Number of snapshot is zero"
+
+       rm -rf "$trace_path"
+}
+
 # MUST set TESTDIR before calling those functions
 plan_tests $NUM_TESTS
 
@@ -402,6 +432,10 @@ test_event_vpid_track_untrack ust 0 "${EVENT_NAME}"
 test_event_tracker ust 1 "${EVENT_NAME}" "--vpid --all"
 test_event_vpid_tracker ust 1 "${EVENT_NAME}"
 
+#snapshot untrack vpid
+
+test_event_ust_vpid_untrack_snapshot
+
 #pid (backward compat)
 
 #non-matching
This page took 0.037553 seconds and 4 git commands to generate.