pombreda / pybootchartgui

Automatically exported from code.google.com/p/pybootchartgui
GNU General Public License v3.0
0 stars 0 forks source link

parse errors of bootchart.tgz causing crash #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

I'm investigating embedding pybootchartgui into moblin2 as part of our fast
boot test/development work, and I'm seeing pybootchartgui crashes:

~/svn/pybootchartgui-read-only $ ./pybootchartgui.py -i .
parsing './bootchart.tgz'
parsing 'header'
parsing 'proc_diskstats.log'
parsing 'proc_ps.log'
warning: no parent for pid '2' with ppid '0'
parsing 'proc_stat.log'
Parse error: expected a timed-block, but timestamp 'bootchartd not running'
is not an integer

the reason is that proc_stat.log has a line looking like this:

"bootchartd not running"

as last line in the file.

the java renderer properly ignores this line and works - pybootchartgui
should probably do the same and ignore this line.

Original issue reported on code.google.com by parallel...@gmail.com on 28 May 2009 at 8:49

GoogleCodeExporter commented 9 years ago
Hi

I think your suggestion makes sense. Can you upload you bootchart.tgz file so I 
can
try the crash myself?

Best
Anders

Original comment by anders.n...@gmail.com on 29 May 2009 at 11:05

GoogleCodeExporter commented 9 years ago

Original comment by parallel...@gmail.com on 29 May 2009 at 4:39

Attachments:

GoogleCodeExporter commented 9 years ago
Any idea yet Anders?

My python is terrible, but it appears the _parse_timed_blocks() def needs 
fixing to
allow the following part to fail:

 38             try:
 39                 return (int(lines[0]), lines[1:])
 40             except ValueError:
 41                 raise ParseError("expected a timed-block, but timestamp '%s' is
not an integer" % lines[0])

should be trivial to code an exception case for the "bootchartd not running" 
case for
anyone who actually knows Python.

Original comment by parallel...@gmail.com on 2 Jun 2009 at 8:06

GoogleCodeExporter commented 9 years ago
Well, I think that the bootchart loogger somehow stopped prematurely?

So if I change the last lines of _parse_timed_blocks()

{{{
except ValueError:
                if lines[0] == "bootchartd not running":
                    return None
                raise ParseError("expected a timed-block, but timestamp '%s' is not
an integer" % lines[0])
    blocks = file.read().split('\n\n')
        return [parse(block) for block in blocks if block.strip() and parse(block)]
}}}

then I get past the first error. But then I get another error when parsing the
proc_ps.log file. In that file there is a newline missing at the end of the file
which gives another crash (until one adds the newline).

Do you know if the bootchart stopped prematurely?

Original comment by anders.n...@gmail.com on 3 Jun 2009 at 1:09

GoogleCodeExporter commented 9 years ago
bootchart was stopped using `/usr/bin/killall -USR1 bootchartd`

Which is exactly what /sbin/bootchartd in case you call it with `stop`:

quote ""killall -USR1 bootchartd"".

I suppose the real bug is in bootchartd itself, but it would be nice if
pybootchartgui would survive this.

Original comment by parallel...@gmail.com on 3 Jun 2009 at 7:51