[lttng-dev] [PATCH lttng-tools 2/3] Fix: data pending: allow empty streams

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Sun Jan 4 21:25:08 EST 2015


There are cases where a stream can be completely empty (no packet to
write) with UST: for instance, if a traced application is either
preempted for a long time, terminated, or stopped, between reserve and
commit. This will make the consumer consider that this stream has no
data ready. If this situation occurs in the first sub-buffer of a
stream, this stream will have no data at all (0 bytes).

Therefore, we need to let the data pending check consider that no data
is pending in this situation, otherwise it can make the data pending
check always return that there is data pending.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 src/common/consumer.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/src/common/consumer.c b/src/common/consumer.c
index 1333263..3f72af3 100644
--- a/src/common/consumer.c
+++ b/src/common/consumer.c
@@ -3548,15 +3548,6 @@ int consumer_data_pending(uint64_t id)
 		 */
 		ret = cds_lfht_is_node_deleted(&stream->node.node);
 		if (!ret) {
-			/*
-			 * An empty output file is not valid. We need at least one packet
-			 * generated per stream, even if it contains no event, so it
-			 * contains at least one packet header.
-			 */
-			if (stream->output_written == 0) {
-				pthread_mutex_unlock(&stream->lock);
-				goto data_pending;
-			}
 			/* Check the stream if there is data in the buffers. */
 			ret = data_pending(stream);
 			if (ret == 1) {
-- 
2.1.1




More information about the lttng-dev mailing list