lttng snapshot record can erroneously claim a successful snapshot (again!)
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.
Updated by David Goulet about 6 years ago
I'll be soon pushing the fix for the first issue. The second issue which is starting session without channel(s) is a different from the snapshot where you shouldn't actually be able to start a session without at least one channel since you can't enable a channel once a session is started.
The patch to fix the first issue will close this bug and I'll open a feature request to address the lttng start problem.