ust: error accounting: don't print error messages if app is dead
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Wed, 21 Apr 2021 20:04:25 +0000 (16:04 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 22 Apr 2021 01:22:51 +0000 (21:22 -0400)
UST applications may exit during the registering process. It's not an
error and should be expected.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I90f91252849ba362e73dad6c30b9cfdc0185abe4

src/bin/lttng-sessiond/event-notifier-error-accounting.c
src/bin/lttng-sessiond/ust-app.c

index 9bc433312ad5209ceacc8c21de73637ada425322..02c99b96bcf0669b765884cac41ec04958842de3 100644 (file)
@@ -491,6 +491,10 @@ event_notifier_error_accounting_register_app(struct ust_app *app)
 
        status = send_counter_data_to_ust(app, new_counter);
        if (status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
+               if (status == EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_APP_DEAD) {
+                       goto error_send_counter_data;
+               }
+
                ERR("Failed to send counter data to application tracer: status = %s, application uid = %d, pid = %d, application name = '%s'",
                                error_accounting_status_str(status),
                                (int) app->uid, (int) app->pid, app->name);
@@ -525,6 +529,10 @@ event_notifier_error_accounting_register_app(struct ust_app *app)
                status = send_counter_cpu_data_to_ust(app, new_counter,
                                new_counter_cpu);
                if (status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
+                       if (status == EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_APP_DEAD) {
+                               goto error_send_cpu_counter_data;
+                       }
+
                        ERR("Failed to send counter cpu data to application tracer: status = %s, application uid = %d, pid = %d, application name = '%s'",
                                        error_accounting_status_str(status),
                                        (int) app->uid, (int) app->pid,
index a49600ec60d42f9f0b7c91ec7c31a810ed985748..750b4b32904511e37925e7e559bb92208f0c341c 100644 (file)
@@ -4067,13 +4067,29 @@ int ust_app_setup_event_notifier_group(struct ust_app *app)
 
        event_notifier_error_accounting_status = event_notifier_error_accounting_register_app(app);
        if (event_notifier_error_accounting_status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
+               if (event_notifier_error_accounting_status == EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_APP_DEAD) {
+                       DBG3("Failed to setup event notifier error accounting (application is dead): app socket fd = %d",
+                                       app->sock);
+                       ret = 0;
+                       goto error_accounting;
+               }
+
                ERR("Failed to setup event notifier error accounting for app");
                ret = -1;
-               goto error;
+               goto error_accounting;
        }
 
        return ret;
 
+error_accounting:
+       lttng_ret = notification_thread_command_remove_tracer_event_source(
+                       the_notification_thread_handle,
+                       lttng_pipe_get_readfd(
+                                       app->event_notifier_group.event_pipe));
+       if (lttng_ret != LTTNG_OK) {
+               ERR("Failed to remove application tracer event source from notification thread");
+       }
+
 error:
        ustctl_release_object(app->sock, app->event_notifier_group.object);
        free(app->event_notifier_group.object);
This page took 0.028308 seconds and 4 git commands to generate.