High cpu usage when either stopping or changing a track

Bug #502989 reported by d53richar
72
This bug affects 14 people
Affects Status Importance Assigned to Milestone
Exaile
Fix Released
High
reacocard

Bug Description

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

The Problem.
 Either stopping or changing a track causes high cpu usuage, this is not too noticable on fast cpu's, however on slow cpu's it causes 100% cpu usage for 20 to 30 seconds.
 The problem originates in xl/track.py/ in def set_tag which raises the global event 'track_tags_changed'
 This gets picked up in the following:
 xlgui/playlist.py def refresh_changed_tracks
 xlgui/panel/collection def refresh_tags_in_tree
 xlgui/panel/playlist.py def refresh_playlists
 This last routine would seem to reload all the playlists (why after a track is changed or stopped? ) and in fact is the guilty culprit.
 What I cannot understand from the code is why the last two routines are called at all?

A Quick Solution is to include the missing key 'sync_on_tag_change' in the [gui] section of the ini file and set it to False
i.e. sync_on_tag_change = B: True

Regards
David

Revision history for this message
d53richar (d53richar) wrote :

Whoops typo on the last line it should read
i.e. sync_on_tag_change = B: False

Revision history for this message
Drew Snellgrove (forkinme-deactivatedaccount) wrote :

Exaile version 3.0.1 from Karmic, I confirmed symptoms and proposed "Quick Solution".

Changed in exaile:
status: New → Confirmed
Revision history for this message
Steve Dodier-Lazaro (sidi) wrote :

Picking the bug, since I'm responsible for this mess. Things to do:

panel/playlists.py:
- generate playlist content only when expanding, and free the treepath when collapsing
- do something only if the changed tag is one among title/artist/albumartist
- only update currently expanded playlists
- do so via a function that will search for the changed track and only refresh this one

Collection:
- do something only if tag is among (title/artist/albumartist/date/genre/composer/any other relevant tag) - might be more clever to do something if ! among a list of internal tags

Playlist:
- do something only when the tag is among the displayed ones, otherwise we really don't care

This should be enough to make the GUI more responsive than it is at the moment.

Changed in exaile:
assignee: nobody → Steve Dodier (sidi)
importance: Undecided → High
milestone: none → 0.3.2
status: Confirmed → Triaged
Revision history for this message
Steve Dodier-Lazaro (sidi) wrote :

I'm attaching a patch that does the trivial part of the job. I don't wanna touch the playlist panel's code too much without being actually understanding it, but this patch already improves performance significantly.

It adds a timer to the handler of the playlists panel, and only triggers it when the changed tag is among title | artist.

It also only refreshes the playlist when the tag that changed is among the currently displayed ones.

Finally, it removes an unused variable in line 1208 of xlgui/playlists.py (!)

Revision history for this message
Tim Su (tim-todoroo) wrote :

I just tried the patch against the tip of the exaile-0.3.x branch, and I still get about 12 seconds of 100% cpu usage when I start playing a new track. What I did was apply the patch and ran an incremental make, which recompiled xl and xlgui. Should I have done something different? Let me know what other info you need!

Revision history for this message
reacocard (reacocard) wrote :

Tim Su: do you have the playcount column shown? if so, hide it and see if performance improves.

Committed patch (minus Makefile changes) trunk/2840 as it definitely does help performance in some cases.

Revision history for this message
Tim Su (tim-todoroo) wrote :

The columns I have displayed are: #, Title, Album, Artist, Length, Rating, Date. Your hint helped, though. I turned off the contextinfo plugin and now don't get the CPU spikes. Too bad, I liked that plugin! Thanks for the tip.

Revision history for this message
Steve Dodier-Lazaro (sidi) wrote : Re: [Bug 502989] Re: High cpu usage when either stopping or changing a track

Err, sorry for the Makefile lines in the diff... I usually don't forget to
remove them :D

Revision history for this message
reacocard (reacocard) wrote :

reassigning to 0.3.3, since the merge of playlistmodel will change a lot of the performance characteristics here.

Changed in exaile:
assignee: Steve Dodier (sidi) → nobody
milestone: 0.3.2 → 0.3.3
Revision history for this message
Mathias Brodala (mathbr) wrote :

Does this issue still occur?

Revision history for this message
Christopher Bratusek (zanghar) wrote :

It does, adding

sync_on_tag_change = B: False

to $HOME/.config/exaile/settings.ini does workaround it. (as stated in the 1st post).

I'm using 0.3.3.0-dev from trunk on Debian/Experimental

Revision history for this message
muzuiget (muzuiget) wrote :

Finally, I solve this problem. Simple, disable plugin Last.fm Covers 0.0.3. (Ubuntu 10.04, Exaile 0.3.2.0)

Maybe the plugin does not use thead to get cover. And your network are very nice so you do not feel it.

Before the plugin fix this bug just diable it by default.

Revision history for this message
Yuriy Voziy (yuretsz) wrote :

CPU load decreases dramatically after unticking 'Write rating and play counts to files'.
This option definitely should use less CPU.

Revision history for this message
reacocard (reacocard) wrote :

Yurly: I think you are in the wrong place, Exaile has no option like that, nor support for that feature.

Is anyone still getting this in current trunk? (rev3885 or so)

Revision history for this message
Mathias Brodala (mathbr) wrote :

Marking as fixed due to lack of further comments or objections.

Changed in exaile:
assignee: nobody → Aren Olson (reacocard)
status: Triaged → Fix Committed
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.