IndexError in Hardware Sensors: list index out of range

Bug #708624 reported by Michael Poole
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Awn Extras
Incomplete
Undecided
Grega Podlesek

Bug Description

This happens reliably when starting the applet on Ubuntu 10.10, with awn and awn-extras 0.4.0+bzr1372-0ubuntu3 installed from the standard "universe" repository. Window manager is metacity (standard Ubuntu GNOME session). The video card is a Radeon HD 6950, the video driver is AMD's Catalyst 11.1 release ("version identifier" 8.81.5, "release identifier" 8.812).

The related packages I installed between when the applet refused to load and when it started crashing were: python-rsvg (2.30.0-1ubuntu5), acpi (1.5-2), libsensors3 (1:2.10.8-2) and hddtemp (0.3-beta15-46).

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/awn/extras/awnlib.py", line 1391, in init_start
    applet_class(applet)
  File "/usr/share/avant-window-navigator/applets/hardware-sensors/hardware-sensors.py", line 109, in __init__
    self.setup_preferences()
  File "/usr/share/avant-window-navigator/applets/hardware-sensors/hardware-sensors.py", line 302, in setup_preferences
    sensor.label = settings["labels"][idx]
IndexError: list index out of range

Revision history for this message
onox (onox) wrote :

Does it also happen if you add a new instance of the hardware-sensors applet?

tags: added: hardware-sensors traceback
Changed in awn-extras:
assignee: nobody → Grega Podlesek (muscardinus)
status: New → Incomplete
Revision history for this message
Michael Poole (mdpoole) wrote :

Yes. If I add a second instance, or remove the first and add it back, each instance still crashes when it tries to load.

Revision history for this message
Michael Poole (mdpoole) wrote :

Possibly related: The "sensors" and "sensors-detect" programs from the lm-sensors package (Ubuntu version 1:3.1.2-6) say they cannot find any sensors. This system has a Core i7-2600K CPU on an Asus P8P67 motherboard, so the kernel might not yet know how to identify whatever sensors are present.

Revision history for this message
onox (onox) wrote :

Can you open gconf-editor. Then go to /apps/instances/awn-applet-hardware-sensors/awn-applet-hardware-sensors-UID where UID is the number that can be found if you do in terminal:

ps a | grep hardware

(Look for --uid=UID)

Then make a screenshot of all the keys and values.

Revision history for this message
Michael Poole (mdpoole) wrote :

Here is the screen shot you asked for. The other three awn-applet-hardware-sensors folders have the same values.

Revision history for this message
onox (onox) wrote :

Please find hardware-sensors.py, then go to roughly line 275. Somewhere there you should see:

sensor_default_settings = {

Insert _above_ that line the following:

for sensor in sensors:
    print repr(sensor.id), repr(sensor.label)

(print is indented with 4 spaces)

Revision history for this message
onox (onox) wrote :

Also go to roughly line 135. You should see 7 assignments:

self.sensors += <something here>

Insert on a new line below those assignments the following:

print self.sensors

Revision history for this message
Michael Poole (mdpoole) wrote :

For clarity, I added some additional print statements just before those, and inside the loop where the crash occurs. The results:

List of hardware sensors:
[<interfaces.hddtempsensors.HDDTempSensor object at 0x2a6df10>, <interfaces.hddtempsensors.HDDTempSensor object at 0x2a6dfd0>, <interfaces.hddtempsensors.HDDTempSensor object at 0x2a75090>]
Sensor IDs and labels:
'/dev/sda' 'Mushkin MKNSSDCL240GB-DX \x10\x80'
'/dev/sdb' 'WDC WD7500AAKS-00RBA0'
'/dev/sdc' 'WDC WD10EARS-00Y5B1'
Processing sensor /dev/sda with index 0
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/awn/extras/awnlib.py", line 1391, in init_start
    applet_class(applet)
  File "/usr/share/avant-window-navigator/applets/hardware-sensors/hardware-sensors.py", line 109, in __init__
    self.setup_preferences()
  File "/usr/share/avant-window-navigator/applets/hardware-sensors/hardware-sensors.py", line 307, in setup_preferences
    sensor.label = settings["labels"][idx]
IndexError: list index out of range
--------------------------------------------------------------------------------

Revision history for this message
onox (onox) wrote :

Around line 280 in hardware-sensors.py, you should see this block:

sensor_default_settings = {
            # Sensor settings
            "ids": [str(sensor.id) for sensor in sensors],
            "labels": [sensor.label for sensor in sensors],
            "show": [sensor.show for sensor in sensors],
            "dialog_row": range(1, len(sensors) + 1),
            "in_icon": [sensor.in_icon for sensor in sensors],
            "high_values": [sensor.high_value for sensor in sensors],
            "low_values": [sensor.low_value for sensor in sensors],
            "high_alarms": [sensor.alarm_on_high for sensor in sensors],
            "low_alarms": [sensor.alarm_on_low for sensor in sensors]
        }

        # Load settings and replace with defaults if not set.
        for key, value in sensor_default_settings.iteritems():
            if key not in self.applet.settings:
                self.applet.settings[key] = value

Put a # in front of every row or just delete the whole block. I don't think it solves the issue but it seems to be dead code.

Find near line 340 the following:

# Save all sensor settings.
settings = self.applet.settings

Put a # in front of it or delete it.

--------------------------------------------------------------------------------

Now, go to line 730, near it you should see:

def label_edited_cb(bla bla bla

Insert a new line below it and put there:

print "label edited"

Now see if you see that text being printed when the applet loads.

In that method (label_edited_cb) you should see an assignment to self.applet.settings["labels"]

Do print self.applet.settings["labels"] before and after that assignment.

Revision history for this message
Michael Poole (mdpoole) wrote :

None of that changed the behavior -- it still crashed on the same line.

What did help was (a) leaving the assignment to sensor_default_settings in place and (b) adjusting the loop just after it:

        # Load settings and replace with defaults if not set.
        for key, value in sensor_default_settings.iteritems():
            if key not in self.applet.settings or len(self.applet.settings[key]) == 0:
                self.applet.settings[key] = value

In gconf-editor, /apps/awn-applet-hardware-sensors/ had every setting value empty -- /usr/share/gconf/schemas/awn-applet-hardware-sensors.schemas defaults /apps/awn-applet-hardware-sensors/labels to [] -- and that was apparently the empty array that caused the crash. With the adjusted loop, the applet starts up and shows three hard-drive temperature sensors. It looks like self.applet.settings is expected to ignore defaulted or unset keys, but I do not know what code implements that.

(You did find the right person on IRC yesterday -- I was AFK most of the day, but I should be around most of today if you want to discuss in real-time. If you would prefer some other network, just let me know where to find you.)

Revision history for this message
Michael Poole (mdpoole) wrote :

This is probably the same basic issue as in https://bugs.launchpad.net/awn-extras/+bug/616246; the sequence of errors is the same (it raises a ValueError when I first add the applet, and IndexError each time I restart awn until I remove that applet instance).

The root cause for me is that the hddtemp server on port 7634 is spitting out a model name that contains garbage at the end. In particular, it looks something like "Mushkin MKNSSDCL240GB-DX \x10\x80". (With more spaces in the middle.) The applet passes that around internally without problems, but the gconf connection rejects the update to self.applet.settings["labels"]. Because the "ids" array is already set by that point, the partially-configured gconf values confuse later startups.

Both "hdparm -i /dev/sda" and "udisks --dump" show just "Mushkin MKNSSDCL240GB-DX" as the model. I will follow up with the author of hddtemp to figure out what the root cause is, and whether hddtemp is doing the expected thing.

Revision history for this message
abrianb (abrianb2003) wrote :

This is my traceback
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/awn/extras/awnlib.py", line 1580, in init_start
    applet_class(applet)
  File "/usr/share/avant-window-navigator/applets/hardware-sensors/hardware-sensors.py", line 109, in __init__
    self.setup_preferences()
  File "/usr/share/avant-window-navigator/applets/hardware-sensors/hardware-sensors.py", line 306, in setup_preferences
    sensor.raw_high_value = settings["high_values"][idx]
IndexError: list index out of range

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.