From: Jonathan Rajotte Date: Thu, 9 Aug 2018 21:21:40 +0000 (-0400) Subject: Fix: Skip uid registry when metadata key value is 0 X-Git-Tag: v2.12.0-rc1~100 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=14d3fca9eddbb059a9dae789affd561cf87337e4;p=lttng-tools.git Fix: Skip uid registry when metadata key value is 0 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 Change-Id: Id7ef34ebc48333f47db4bdca907cf81911b60d1d Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index d0980220d..b1dba0a09 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -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); diff --git a/tests/regression/tools/tracker/test_event_tracker b/tests/regression/tools/tracker/test_event_tracker index 0daa2f8b5..b4563b333 100755 --- a/tests/regression/tools/tracker/test_event_tracker +++ b/tests/regression/tools/tracker/test_event_tracker @@ -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