Fix: check validity of a stream before invoking ust flush command
[lttng-tools.git] / src / common / ust-consumer / ust-consumer.c
index 4d0b530a7ce798e5fe0295dbe6a1caf1a5ddabf0..6009ef1f864928b5ebf5b713f0a32f505c48a885 100644 (file)
@@ -768,10 +768,19 @@ static int flush_channel(uint64_t chan_key)
                health_code_update();
 
                pthread_mutex_lock(&stream->lock);
+
+               /*
+                * Protect against concurrent teardown of a stream.
+                */
+               if (cds_lfht_is_node_deleted(&stream->node.node)) {
+                       goto next;
+               }
+
                if (!stream->quiescent) {
                        ustctl_flush_buffer(stream->ustream, 0);
                        stream->quiescent = true;
                }
+next:
                pthread_mutex_unlock(&stream->lock);
        }
 error:
This page took 0.025754 seconds and 5 git commands to generate.