Fix: sessiond: bounded snapshot record fails when no streams exist
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 3 Feb 2020 22:25:58 +0000 (17:25 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 5 Feb 2020 20:57:08 +0000 (15:57 -0500)
commit76a95f15afd7b1abddf714e2e6431a8bfa46fc15
treea06333b93e4283757459b1583db7504b3fc29708
parent375731ccc39085dba006dd9d14b9d598d60003af
Fix: sessiond: bounded snapshot record fails when no streams exist

Attempting to record a snapshot with a `--max-size` fails when no
streams exist. For instance, attempting to record a snapshot for a
user space session when no applications are running will fail with the
following output:

Error: Invalid snapshot size. Cannot fit at least one packet per stream.
Error: Snapshot max size is invalid

The function get_session_nb_packets_per_stream() computes an
approximation of the number of packets to capture to honor the maximal
size specified. However, at the end, it doesn't distinguish between
'0' meaning that "no packets can be captured" (no streams exist) and
'0' meaning that "the max size is too small to accomodate one packet".

Those two cases can be distinguished by checking if the 'size_left' is
still the 'max_size', meaning that not even the size of one packet was
substracted from 'max_size'.

Reported-by: Simon Marchi <simark@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I5caef9ce926bbc7143a90667749ffaed972590c1
src/bin/lttng-sessiond/cmd.c
This page took 0.025256 seconds and 4 git commands to generate.