Fix: check validity of a stream before invoking ust flush command
[lttng-tools.git] / src / common / ust-consumer / ust-consumer.c
index 01e27bf666d25d09ff1ed9843df119253ff59971..514278d91fd930fac88603286e93fec16c7691a5 100644 (file)
@@ -775,10 +775,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.023816 seconds and 4 git commands to generate.