Bug #662
closedlttng snapshot record can erroneously claim a successful snapshot (again!)
100%
Description
This is similar to Bug #606 but different.
If a normal snapshot-mode session is created, the snapshot record
action can "fail" while giving the appearance of success:
$ sudo -H lttng create snap2 --snapshot Session snap2 created. Default snapshot output set to: /root/lttng-traces/snap2-20131115-115000 Snapshot mode set. Every channel enabled for that session will be set in overwrite mode and mmap output. $ sudo -H lttng enable-channel channel0 --buffers-uid -u UST channel channel0 enabled for session snap2 $ sudo -H lttng enable-event -u -a -c channel0 All UST events are enabled in channel channel0 $ sudo -H lttng start Tracing started for session snap2 $ sudo -H lttng snapshot record Snapshot recorded successfully for session snap2
In this case, no instrumented user-space apps were run, so the buffers were empty. We don't get an empty trace on disc: we get no trace at all.
The same thing happens if we just enable the channel and don't bother to enable events at all.
I think in all cases we should consistently either a) get an empty trace on disc and a warning to that effect, or b) get an error back from the record
action (and no trace on disc).
On the other hand, if the trace is started channel-less, we get an error:
$ sudo -H lttng create snap1 --snapshot Session snap1 created. Default snapshot output set to: /root/lttng-traces/snap1-20131115-114912 Snapshot mode set. Every channel enabled for that session will be set in overwrite mode and mmap output. $ sudo -H lttng start Tracing started for session snap1 $ sudo -H lttng snapshot record Error: Snapshot record failed
My only complaint here is that the error message isn't very expressive.
It would be nice to enhance the start
command so it warns that the trace just started cannot produce any data ever because it has no channels (last example above). This is worthwhile since channels cannot be created after a trace has been started. Events, on the other hand, can be created while a trace is running, so a weaker warning could be pertinent. Call it a hint.