From: Jérémie Galarneau Date: Wed, 3 Feb 2021 22:00:06 +0000 (-0500) Subject: Fix: sessiond: assertion fails when getting name of trigger X-Git-Tag: v2.13.0-rc1~355 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ce0b1d61919f37517a6212f7af2afe0fa1b1dcb0;p=lttng-tools.git Fix: sessiond: assertion fails when getting name of trigger Left-over debug code assumes that a trigger is named and logs registration/unregistration failures as errors, resulting in a spammy sessiond output. Reduce the logging verbodity of those statements to DBG and handle unnamed triggers. Signed-off-by: Jérémie Galarneau Change-Id: I74a90150ec2b0914784fb187517025a9a3019cfb --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 5c8efb40e..2ba825da0 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -4323,7 +4323,9 @@ enum lttng_error_code cmd_register_trigger(const struct lttng_credentials *cmd_c enum lttng_trigger_status trigger_status; trigger_status = lttng_trigger_get_name(trigger, &trigger_name); - assert(trigger_status == LTTNG_TRIGGER_STATUS_OK); + trigger_name = trigger_status == LTTNG_TRIGGER_STATUS_OK ? + trigger_name : "(unnamed)"; + trigger_status = lttng_trigger_get_owner_uid( trigger, &trigger_owner); assert(trigger_status == LTTNG_TRIGGER_STATUS_OK); @@ -4373,11 +4375,15 @@ enum lttng_error_code cmd_register_trigger(const struct lttng_credentials *cmd_c ret_code = notification_thread_command_register_trigger(notification_thread, trigger); if (ret_code != LTTNG_OK) { - ERR("Failed to register trigger to notification thread: trigger name = '%s', trigger owner uid = %d, error code = %d", + DBG("Failed to register trigger to notification thread: trigger name = '%s', trigger owner uid = %d, error code = %d", trigger_name, (int) trigger_owner, ret_code); goto end_notification_thread; } + trigger_status = lttng_trigger_get_name(trigger, &trigger_name); + trigger_name = trigger_status == LTTNG_TRIGGER_STATUS_OK ? + trigger_name : "(unnamed)"; + ret_code = trigger_modifies_event_notifier(trigger, &must_update_event_notifier); if (ret_code != LTTNG_OK) { ERR("Failed to determine if event modifies event notifiers: trigger name = '%s', trigger owner uid = %d, error code = %d", @@ -4443,7 +4449,7 @@ enum lttng_error_code cmd_unregister_trigger(const struct lttng_credentials *cmd enum lttng_trigger_status trigger_status; trigger_status = lttng_trigger_get_name(trigger, &trigger_name); - assert(trigger_status == LTTNG_TRIGGER_STATUS_OK); + trigger_name = trigger_status == LTTNG_TRIGGER_STATUS_OK ? trigger_name : "(unnamed)"; trigger_status = lttng_trigger_get_owner_uid( trigger, &trigger_owner); assert(trigger_status == LTTNG_TRIGGER_STATUS_OK); @@ -4479,7 +4485,7 @@ enum lttng_error_code cmd_unregister_trigger(const struct lttng_credentials *cmd ret_code = notification_thread_command_unregister_trigger(notification_thread, trigger); if (ret_code != LTTNG_OK) { - ERR("Failed to unregister trigger from notification thread: trigger name = '%s', trigger owner uid = %d, error code = %d", + DBG("Failed to unregister trigger from notification thread: trigger name = '%s', trigger owner uid = %d, error code = %d", trigger_name, (int) trigger_owner, ret_code); }