Fix: kernel channel destroy on consumer if sent
authorDavid Goulet <dgoulet@efficios.com>
Tue, 25 Feb 2014 17:21:32 +0000 (12:21 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 25 Feb 2014 17:26:48 +0000 (12:26 -0500)
An enable-channel immediately followed by a destroy session triggered an
assert on the consumer followed by the shutdown of the consumer thread
for the kernel.

This fix make sure we don't ask the consumer to destroy a channel if not
previously sent to it and handle not found channel on destroy.

Fixes #643

Signed-off-by: David Goulet <dgoulet@efficios.com>
Conflicts:
src/common/kernel-consumer/kernel-consumer.c
- No health in stable-2.3 thus had to remove a health update
code statement.

src/bin/lttng-sessiond/kernel.c
src/common/kernel-consumer/kernel-consumer.c

index 531f65488568e2f9f6d4033781230af3def1ca7f..caf0a9f35ddc19c4eb5bc01a446cdf1f2ae4d024 100644 (file)
@@ -755,11 +755,11 @@ void kernel_destroy_session(struct ltt_kernel_session *ksess)
        DBG("Tearing down kernel session");
 
        /*
-        * Destroy channels on the consumer if in no output mode because the
-        * streams are in *no* monitor mode so we have to send a command to clean
-        * them up or else they leaked.
+        * Destroy channels on the consumer if at least one FD has been sent and we
+        * are in no output mode because the streams are in *no* monitor mode so we
+        * have to send a command to clean them up or else they leaked.
         */
-       if (!ksess->output_traces) {
+       if (!ksess->output_traces && ksess->consumer_fds_sent) {
                int ret;
                struct consumer_socket *socket;
                struct lttng_ht_iter iter;
index 712ca90f33070a86e696fd2d71b3227e877e80ec..e4fd2afee4805f91e03a5546725b272fd17888e3 100644 (file)
@@ -809,6 +809,11 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                        goto end_nosignal;
                }
 
+               /* Stop right now if no channel was found. */
+               if (!channel) {
+                       goto end_nosignal;
+               }
+
                /*
                 * This command should ONLY be issued for channel with streams set in
                 * no monitor mode.
This page took 0.028844 seconds and 4 git commands to generate.