Fix: sessiond: assertion fails when getting name of trigger
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 3 Feb 2021 22:00:06 +0000 (17:00 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 3 Feb 2021 22:14:08 +0000 (17:14 -0500)
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 <jeremie.galarneau@efficios.com>
Change-Id: I74a90150ec2b0914784fb187517025a9a3019cfb

src/bin/lttng-sessiond/cmd.c

index 5c8efb40ee2c658e4959716836de214dc4bdc5a2..2ba825da006cae03d2bb5a8ab396d4642843f5df 100644 (file)
@@ -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);
        }
 
This page took 0.03737 seconds and 4 git commands to generate.