Project

General

Profile

Actions

Bug #1302

open

Bad handling of invalid saved session files

Added by Simon Marchi about 1 month ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
04/02/2021
Due date:
% Done:

0%

Estimated time:

Description

When one file in ~/.lttng/sessions can't be parsed or doesn't validate, it makes it impossible to load any session. The file may not validate because it is corrupted, or it was created using a more recent LTTng version that produces new attributes unknown to the LTTng version being used for the load.

To reproduce:

1. Save two sessions: lttng create working && lttng save && lttng destroy && lttng create broken && lttng save && lttng destroy
2. That should create two files in ~/.lttng/sessions
3. Manually make ~/.lttng/sessions/broken.lttng unreadable, for example by replacing <started>false</started> with <started>tourlou</started>.
4. Try to load session working with lttng load working

This is what I get:

$ lttng load working
XML Error: Element 'started': 'tourlou' is not a valid value of the atomic type 'xs:boolean'.
Error: Session configuration file validation failed
Session working has been loaded successfully

Things to note:

  • the various error/warning messages should mention the file name
  • "Error: Session configuration file validation failed" should probably say "Warning", otherwise it sounds like it's a showstopper
  • I would also finish that last message with something like ", skipping." to show that lttng keeps looking for a session with the name working (if that's indeed the intended behavior, I'm not sure)
  • Even though it says Session working has been loaded successfully, it's not true:
$ lttng list
Currently no available tracing session

No data to display

Actions

Also available in: Atom PDF