[PATCH] bootchart.jar crashes on generated bootchart.tgz

Bug #254954 reported by David Gaarenstroom
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bootchart (Ubuntu)
Fix Released
Undecided
Unassigned
Nominated for Intrepid by David Gaarenstroom

Bug Description

Binary package hint: bootchart

Description: Ubuntu 8.04.1
Release: 8.04
bootchart:
  Installed: 0.9-0ubuntu7
  Candidate: 0.9-0ubuntu7
  Version table:
 *** 0.9-0ubuntu7 0
        500 http://nl.archive.ubuntu.com hardy/main Packages
        100 /var/lib/dpkg/status

The bug:
-----------
In /etc/init.d/stop-bootchart the line:
    /usr/bin/java -jar /usr/share/bootchart/bootchart.jar

sometimes crashes with the following message:

Parsing /var/log/bootchart.tgz
Exception in thread "main" java.lang.NullPointerException
        at org.bootchart.parser.linux.ProcStatParser.parseLog(Unknown Source)
        at org.bootchart.Main.render(Unknown Source)
        at org.bootchart.Main.main(Unknown Source)

Analysis:
-----------
I have traced this back to bootchart.jar actually having problems parsing the log files in /var/log/bootchart.tgz where each time this occurs, one of the three files lacks a complete record. The last line of such a file allways contains an uptime entry and is not followed by the content of either /proc/stat, /proc/diskstats, proc/*/stat of that moment.

It seems that the shell function "stop_bootchart()" in /etc/init.d/stop-bootchart sometimes has a timing issue, where it kills the bootchart logging right after the uptime is inserted in the log. On my Via C3 500MHz system, this situation seems to occur regularly, whereas on my workstation this happened only three or four times in the last couple of months.

Proposed solution:
------------------------
I'd like to propose a patch for /usr/share/initramfs-tools/scripts/init-top/bootchart which basicly turns:
        sed -e "s/ [0-9].*//;s/\.//" < /proc/uptime
        cat /proc/stat
into:
        sed -e "s/ [0-9].*//;s/\.//" < /proc/uptime | cat - /proc/stat

With this change I haven't had any bootchart generation failures whatsoever.

Revision history for this message
David Gaarenstroom (david-gaarenstroom) wrote :
Revision history for this message
David Gaarenstroom (david-gaarenstroom) wrote :

Here is my proposed patch:

Revision history for this message
Paco Riviere (pacoriviere) wrote :

It worket fot me (uname -a Linux fujix 2.6.24-19-generic #1 SMP Wed Aug 20 22:56:21 UTC 2008 i686 GNU/Linux)

Revision history for this message
David Gaarenstroom (david-gaarenstroom) wrote :

Then I'll change the status to "Confirmed".

Changed in bootchart:
status: New → Confirmed
Revision history for this message
Frank Groeneveld (frankgroeneveld) wrote :

The fix works great. When will this be comitted?

Changed in bootchart:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.