[lttng-dev] [PATCH lttng-tools] Fix: lost packet accounting always lost on snapshot

Julien Desfossez jdesfossez at efficios.com
Tue Jul 25 19:23:49 UTC 2017


Because of the continue when we fail to get a subbuff, the lost_packet
count is always reset to 0 before we can account it in the channel. Now
we account it directly before the continue.

Reported-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
 src/common/kernel-consumer/kernel-consumer.c | 11 +----------
 src/common/ust-consumer/ust-consumer.c       | 11 +----------
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c
index 8d00a0d..7686356 100644
--- a/src/common/kernel-consumer/kernel-consumer.c
+++ b/src/common/kernel-consumer/kernel-consumer.c
@@ -249,7 +249,6 @@ int lttng_kconsumer_snapshot_channel(uint64_t key, char *path,
 		while (consumed_pos < produced_pos) {
 			ssize_t read_len;
 			unsigned long len, padded_len;
-			int lost_packet = 0;
 
 			health_code_update();
 
@@ -270,7 +269,7 @@ int lttng_kconsumer_snapshot_channel(uint64_t key, char *path,
 				 * content of the final snapshot).
 				 */
 				if (!before_first_packet) {
-					lost_packet = 1;
+					stream->chan->lost_packets++;
 				}
 				continue;
 			}
@@ -313,14 +312,6 @@ int lttng_kconsumer_snapshot_channel(uint64_t key, char *path,
 			}
 			consumed_pos += stream->max_sb_size;
 
-			/*
-			 * Only account lost packets located between
-			 * succesfully extracted packets (do not account before
-			 * and after since they are not visible in the
-			 * resulting snapshot).
-			 */
-			stream->chan->lost_packets += lost_packet;
-			lost_packet = 0;
 			before_first_packet = false;
 		}
 
diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c
index 4297d60..74853cd 100644
--- a/src/common/ust-consumer/ust-consumer.c
+++ b/src/common/ust-consumer/ust-consumer.c
@@ -1150,7 +1150,6 @@ static int snapshot_channel(uint64_t key, char *path, uint64_t relayd_id,
 		while (consumed_pos < produced_pos) {
 			ssize_t read_len;
 			unsigned long len, padded_len;
-			int lost_packet = 0;
 
 			health_code_update();
 
@@ -1171,7 +1170,7 @@ static int snapshot_channel(uint64_t key, char *path, uint64_t relayd_id,
 				 * content of the final snapshot).
 				 */
 				if (!before_first_packet) {
-					lost_packet = 1;
+					stream->chan->lost_packets++;
 				}
 				continue;
 			}
@@ -1209,14 +1208,6 @@ static int snapshot_channel(uint64_t key, char *path, uint64_t relayd_id,
 			}
 			consumed_pos += stream->max_sb_size;
 
-			/*
-			 * Only account lost packets located between
-			 * succesfully extracted packets (do not account before
-			 * and after since they are not visible in the
-			 * resulting snapshot).
-			 */
-			stream->chan->lost_packets += lost_packet;
-			lost_packet = 0;
 			before_first_packet = false;
 		}
 
-- 
2.7.4



More information about the lttng-dev mailing list