ZeroDivisionError in CPU Frequency Monitor: float division by zero

Bug #774916 reported by ali hichem
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Awn Extras
Fix Released
Low
onox

Bug Description

*python-awn-extras:
0.4.1~bzr1507-0ubuntu1

*OS:
Ubuntu 11.04

*traceback:
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/awn/extras/awnlib.py", line 1580, in init_start
    applet_class(applet)
  File "/usr/share/avant-window-navigator/applets/cpufreq/cpufreq.py", line 132, in __init__
    self.draw_freq_cb()
  File "/usr/share/avant-window-navigator/applets/cpufreq/cpufreq.py", line 299, in draw_freq_cb
    number = float(self.backend.get_current_frequency() - self.backend.get_phys_min_frequency()) / self.freq_range_per_image
ZeroDivisionError: float division by zero

Related branches

onox (onox)
description: updated
tags: added: cpu-freq traceback
removed: awn
Revision history for this message
onox (onox) wrote :

Thanks for the bug report. Can you edit /usr/share/avant-window-navigator/applets/cpufreq/cpufreq.py and go to line 155. You should see something that begins with:

self.freq_range_per_image = ...

Please insert a new line above it with the following text:

print self.backend.get_phys_max_frequency(), self.backend.get_phys_min_frequency()

Then run avant-window-navigator in a terminal check which numbers it prints.

Please also tell me which CPU you have. You can do this by running in a terminal:

cat /proc/cpuinfo > awn_cpufreq_cpuinfo

Then attach the file awn_cpufreq_cpuinfo that you will find in your home folder to this bug report. (See the link below the comment form)

Changed in awn-extras:
assignee: nobody → onox (onox)
status: New → Incomplete
description: updated
Revision history for this message
ali hichem (ali-hichem) wrote :
Download full text (4.3 KiB)

I did what you ask me to do and here's the result from the terminal :

** (avant-window-navigator:15533): DEBUG: Spawned awn-applet[15551] for "cpufreq.desktop", UID: 1304267871, XID: 16777298

** (awn-applet:15540): WARNING **: Helpers are not available...
Please make sure you have dockmanager package installed.

(awn-applet:15549): GLib-GObject-WARNING **: g_object_newv: construct property "panel-id" for object `AwnTerminalApplet' can't be set twice
ShinySwitcher Message: viewport/compiz detected.. using existing workspace config
** (awn-applet:15549): DEBUG: awn-terminal.vala:80: keybinding:
** (awn-applet:15549): DEBUG: awn-terminal.vala:80: keybinding:
HDDTemp sensors interface: Socket error(111): Connection refused
2000000 --------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/awn/extras/awnlib.py", line 1580, in init_start
    applet_class(applet)
  File "/usr/share/avant-window-navigator/applets/cpufreq/cpufreq.py", line 132, in __init__
    self.draw_freq_cb()
  File "/usr/share/avant-window-navigator/applets/cpufreq/cpufreq.py", line 302, in draw_freq_cb
    number = float(self.backend.get_current_frequency() - self.backend.get_phys_min_frequency()) / self.freq_range_per_image
ZeroDivisionError: float division by zero
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/awn/extras/awnlib.py", line 1233, in callback_wrapper
    callback()
  File "/usr/share/avant-window-navigator/applets/cpufreq/cpufreq.py", line 302, in draw_freq_cb
    number = float(self.backend.get_current_frequency() - self.backend.get_phys_min_frequency()) / self.freq_range_per_image
ZeroDivisionError: float division by zero

** (cpufreq.py:15551): WARNING **: get_pixbuf_at_size: state '11' not present in list
/usr/lib/pymodules/python2.7/awn/extras/awnlib.py:1592: Warning: g_object_unref: assertion `G_IS_OBJECT (object)' failed
  gtk.main()

** (cpufreq.py:15551): WARNING **: get_pixbuf_at_size: state '13' not present in list

** (cpufreq.py:15551): WARNING **: get_pixbuf_at_size: state '12' not present in list

** (cpufreq.py:15551): WARNING **: get_pixbuf_at_size: state '1' not present in list

** (cpufreq.py:15551): WARNING **: get_pixbuf_at_size: state '0' not present in list

** (cpufreq.py:15551): WARNING **: get_pixbuf_at_size: state '3' not present in list

** (cpufreq.py:15551): WARNING **: get_pixbuf_at_size: state '2' not present in list

** (cpufreq.py:15551): WARNING **: get_pixbuf_at_size: state '5' not present in list

** (cpufreq.py:15551): WARNING **: get_pixbuf_at_size: state '4' not present in list

** (cpufreq.py:15551): WARNING **: get_pixbuf_at_size: state '7' not present in list

** (cpufreq.py:15551): WARNING **: get_pixbuf_at_size: state '6' not present in list

** (cpufreq.py:15551): WARNING **: get_pixbuf_at_size: state '9' not present in list

** (cpufreq.py:15551): WARNING **: get_pixbuf_at_size: state '8' not present in list

** (cpufreq.py:15551): WARNING **: get_pixbuf_at_size: state '11' not present in list

** (cpufreq.py:15551)...

Read more...

Revision history for this message
onox (onox) wrote :

Hmm, I only see the number 2000000. You have 2 cpus. Assuming you have set the applet to use cpu 0, please try this in a terminal:

cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq

If you used cpu 1, you should change cpu0 to cpu1. Executing those 2 lines above should each print a number.

Revision history for this message
ali hichem (ali-hichem) wrote :

here's the terminal out:

 cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
2000000
 cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq
2000000
cat /sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_max_freq
2000000
 cat /sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_min_freq
2000000

In fact I'd like to notice that I don't have 2 cpu, I only have one physical cpu with 2 core (intel core 2 duo with 3Gh each one) with overclock at 6 * 333.

Revision history for this message
onox (onox) wrote :

Yeah, I meant cores when I said cpus. Anyway your cpuinfo_max_freq = cpuinfo_min_freq as I expected. The applet kinda assumes that cpuinfo_max_freq > cpuinfo_min_freq. Don't know why they're the same on your system. Can you do:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

And for the fun (I don't have access to a multi core machine running Linux):

cat /sys/devices/system/cpu/cpu0/cpufreq/related_cpus
cat /sys/devices/system/cpu/cpu0/cpufreq/affected_cpus

Please also do:

uname -r

And:

dmesg | grep centrino

and:

dmesg | grep cpufreq

Btw, have you tried to do cpufreq scaling before (working)?

Revision history for this message
ali hichem (ali-hichem) wrote :

here's the out:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
2000000

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
conservative ondemand userspace powersave performance

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
2000000

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
2000000

cat /sys/devices/system/cpu/cpu0/cpufreq/related_cpus
0

cat /sys/devices/system/cpu/cpu0/cpufreq/affected_cpus
0

uname -r
2.6.38-8-generic

dmesg | grep centrino
(nothing)
dmesg | grep cpufreq
(nothing)

Btw, have you tried to do cpufreq scaling before (working)?
no, sorry

Revision history for this message
onox (onox) wrote :

Thanks for your cooperation. The applet uses the difference between cpuinfo_max_freq and cpuinfo_min_freq to determine which image to display in the Awn dock. If scaling_available_frequencies has only 1 frequency, then scaling is not possible.

I'll fix the applet to fall-back to non-scaling mode (meaning that it just displays the current frequency), but I cannot fix the problem that cpuinfo_max_freq = cpuinfo_min_freq. This may be a bug in Ubuntu, so file a bug at launchpad.net/ubuntu and tell them that on your system with your CPU you get cpuinfo_max_freq = cpuinfo_min_freq = scaling_available_frequencies. Good luck!

Changed in awn-extras:
importance: Undecided → Low
milestone: none → 0.4.2
status: Incomplete → Confirmed
Revision history for this message
onox (onox) wrote :

Fixed in revision 1529.

Changed in awn-extras:
status: Confirmed → Fix Committed
Povilas Kanapickas (p12)
Changed in awn-extras:
status: Fix Committed → 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.