increasing cpu overhead after playing for a long time

Bug #498868 reported by d53richar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Exaile
Fix Released
Low
Unassigned

Bug Description

Exaile version 3.0.1 from Karmic and version 3.0.2 from PPA
Ubuntu Karmic

The Problem.
Running a playlist in repeat mode will eventually cause the cpu load to increase to 100%.
This more noticeable on slower cpu's i.e. I have a 900Mhz P3 as a test machine which starts off at 8% cpu usage for exaile, this increases by approx 8% per hour so that after 12hrs exaile is using 100% of cpu time. In contrast to this, another test machine 3Ghz dual P4 starts out at <1% but this still increases, albeit at a slower pace.

So far I have been able to determine that the problem lies with the progress bar. (xlgui/main.py)
In timer_update the following calls are made
   self.player.get_progress()
   track.get_duration()
   self.player.get_time()
all of these call seem to contribute to the increase in cpu time.

I can alleviate part of the problem by modifying how track.get_duration is used (it really only needs to called once at the start of playing a track) by declaring a global variable
      self.track_length in __init__
and using it in playback_start by adding
      track = self.player.current
      self.track_length = track.get_duration()
then referencing this in timer_update as
      self._set_bar_text(seconds, self.track_length)

I am at the moment stuck on why these calls should cause this behaviour.
More investigation is called for but the long test times required, at least an hour on a slow machine, make it a time consuming exercise.
Note. Slow cpu's also include intel atom's which run at 1.5Ghz and intel celeron N220 as these cpu's are used in netbooks and nettops this could be a major issue for a lot of other users.

Regards
David

Related branches

Revision history for this message
reacocard (reacocard) wrote :

repeat calls to those funcs really should not increase cpu overhead continually. All three do very simple tasks that don't have any persistent effect. Without more data on why this happens, there really isn't much we can do about this bug, and an easy workaround is to just quit Exaile every so often, which with playlist and playback resume enabled is not hugely intrusive.

Changed in exaile:
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
d53richar (d53richar) wrote :

SOLVED.
Sometimes I need my head screwing on correctly.
The problem is not in the timer_update routine but in the playback_start routine.
The following code needs to be added before we create a new timer to ensure that the current timer is destroyed before a new one is created.

if self.timer_id:
            gobject.source_remove(self.timer_id)

This ensures that only one timer exists at a time otherwise we end up with multiple timers all doing the same thing, that is why the cpu usage increases.

Regards
David

Revision history for this message
reacocard (reacocard) wrote :

thanks, fix committed 0.3.0.x/2473, trunk/2741.

Changed in exaile:
milestone: none → 0.3.0.3
status: Incomplete → Fix Committed
reacocard (reacocard)
Changed in exaile:
milestone: 0.3.0.3 → 0.3.1
reacocard (reacocard)
Changed in exaile:
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.