Fix: sessiond: metadata not created on app unregistration during start
[lttng-tools.git] / src / bin / lttng-sessiond / ust-app.c
index befbfab32dc2c692b56ef3005e4e46ad0ef9bf2a..6c150540042021f1b2f6a90d1802b24e25a71ac7 100644 (file)
@@ -4356,15 +4356,6 @@ int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app)
                goto skip_setup;
        }
 
-       /*
-        * Create the metadata for the application. This returns gracefully if a
-        * metadata was already set for the session.
-        */
-       ret = create_ust_app_metadata(ua_sess, app, usess->consumer);
-       if (ret < 0) {
-               goto error_unlock;
-       }
-
        health_code_update();
 
 skip_setup:
@@ -5032,6 +5023,7 @@ void ust_app_synchronize(struct ltt_ust_session *usess,
        }
 
        rcu_read_lock();
+
        cds_lfht_for_each_entry(usess->domain_global.channels->ht, &uchan_iter,
                        uchan, node.node) {
                struct ust_app_channel *ua_chan;
@@ -5075,6 +5067,21 @@ void ust_app_synchronize(struct ltt_ust_session *usess,
                        }
                }
        }
+
+       /*
+        * Create the metadata for the application. This returns gracefully if a
+        * metadata was already set for the session.
+        *
+        * The metadata channel must be created after the data channels as the
+        * consumer daemon assumes this ordering. When interacting with a relay
+        * daemon, the consumer will use this assumption to send the
+        * "STREAMS_SENT" message to the relay daemon.
+        */
+       ret = create_ust_app_metadata(ua_sess, app, usess->consumer);
+       if (ret < 0) {
+               goto error_unlock;
+       }
+
        rcu_read_unlock();
 
 end:
@@ -6747,7 +6754,7 @@ enum lttng_error_code ust_app_open_packets(struct ltt_session *session)
                                         * Per-PID buffer and application going
                                         * away.
                                         */
-                                       if (ret == -LTTNG_ERR_CHAN_NOT_FOUND) {
+                                       if (open_ret == -LTTNG_ERR_CHAN_NOT_FOUND) {
                                                continue;
                                        }
 
This page took 0.02998 seconds and 4 git commands to generate.