From 66ff8e3f938e33a59c55ecf8011422a4c0174ce7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 5 Dec 2017 15:25:28 -0500 Subject: [PATCH] Fix: notification thread not notified of channel creation on app error MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The multi-app notification test is failing (more often on ARM64) since the notification thread appears to not be notified of a channel's creation under some circumstances. Investigating this failure pointed to create_channel_per_uid() which provides the "hook" the notification system needs to be informed of a channel's creation. The first time this function is invoked for a given channel, the lookup in the buffer registry will fail, prompting the lazy creation of the channel. Then, that channel is sent to the application being registered. The error in the current code is that the channel's creation is not communicated to the notification subsystem whenever the session daemon fails to communicate with the application. Failing to communicate with the application is not a channel creation error (in per-uid mode). In this specific case, the test is launching many short-lived applications and it is expected for the session daemon to encounter closing or dead applications as it handles their registration. Note that the diff of this commit is misleading. The important part is that notification_thread_command_add_channel() has to be performed regardless of the result of send_channel_uid_to_ust(). Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/ust-app.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index e79455b01..54479e23c 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -2917,15 +2917,6 @@ static int create_channel_per_uid(struct ust_app *app, created = true; } - /* Send buffers to the application. */ - ret = send_channel_uid_to_ust(reg_chan, app, ua_sess, ua_chan); - if (ret < 0) { - if (ret != -ENOTCONN) { - ERR("Error sending channel to application"); - } - goto error; - } - if (created) { enum lttng_error_code cmd_ret; struct ltt_session *session; @@ -2961,6 +2952,15 @@ static int create_channel_per_uid(struct ust_app *app, } } + /* Send buffers to the application. */ + ret = send_channel_uid_to_ust(reg_chan, app, ua_sess, ua_chan); + if (ret < 0) { + if (ret != -ENOTCONN) { + ERR("Error sending channel to application"); + } + goto error; + } + error: return ret; } -- 2.34.1