Fix: check validity of a stream before invoking ust flush command
[lttng-tools.git] / src / common / ust-consumer / ust-consumer.c
index cc77739ce301c0954c59d2a7437126e5829061f9..88b687611fc8714675722f8616a85b10fce40baa 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.023224 seconds and 4 git commands to generate.